小编mar*_*tin的帖子

Github 页面上的 Jekyll:如何在脚注中包含外部内容?

由于 Jekyll-Scholar 在 Github 页面上不可用,我正在尝试找到一种解决方法来拥有某种参考书目功能,使用 kramdown 脚注和包含。我想留在 Github Pages 工作流程中,而不是在本地编译网站。

我有一个包含所有参考文献的集合_data/biblio.yaml

- authors: Me, Her and Him
  title: A Serious Article
  key: ref1
Run Code Online (Sandbox Code Playgroud)

page1.md我有:

This is a sentence with a citation[^1]

[^1]: 
    {% include citation.html key="ref1" %}
Run Code Online (Sandbox Code Playgroud)

我有_includes/citation.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>
Run Code Online (Sandbox Code Playgroud)

这不起作用,因为编译后引用会在脚注定义之前呈现,而不是在脚注定义内:

<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 …
Run Code Online (Sandbox Code Playgroud)

jekyll github-pages

5
推荐指数
1
解决办法
572
查看次数

标签 统计

github-pages ×1

jekyll ×1