5

As Jekyll-Scholar is not available on Github Pages, I am trying to find a workaround to have some kind of bibliography features, using kramdown footnotes and include. I would like to stay in the Github Pages workflow and not to compile the website locally.

I have a collection with all references in _data/biblio.yaml:

- authors: Me, Her and Him title: A Serious Article key: ref1 

In page1.md I have:

This is a sentence with a citation[^1] [^1]: {% include citation.html key="ref1" %} 

And in _includes/citation.html I have a template for citations:

{% assign citation = site.data.biblio | where:"key", include.key | first %} <span class="cit-authors">{{citation.authors}}</span>, <span class="cit-title">{{citation.title}}</span> 

This does not work, as after compilation the citation is rendered before and not inside the footnote definition:

<p> <span class="cit-authors">Me, Her and Him</span>, <span class="cit-title">A Serious Article</span> </p> <div class="footnotes"> <ol> <li id="fn:1"> <p><a href="#fnref:1" class="reversefootnote">&#8617;</a></p> </li> </ol> </div> 

The desired result is obviously to have the included content inside the <li> block.

Is there a reason why this does not work? Is there any way to make it work as desired?

1 Answer 1

3

In _includes/citation.html, your assign statement introduces a useless line break, which breaks kramdown parsing.

You can remove the line break between assign and html

{% assign citation = site.data.biblio | where:"key", include.key | first %}<span class="cit-authors">{{citation.authors}}</span>, <span class="cit-title">{{citation.title}}</span> 

or use the new liquid whitespace control ({%- tag -%})

{%- assign citation = site.data.biblio | where:"key", include.key | first -%} <span class="cit-authors">{{citation.authors}}</span>, <span class="cit-title">{{citation.title}}</span> 
Sign up to request clarification or add additional context in comments.

1 Comment

I implemented your second solution, worked like a charm! Thank you very much

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.