为什么 liquid/jekyll 插入了代码标签,我该如何删除它们?

Why are code tags being inserted by liquid/jekyll and how do I remove them?

我想为我正在使用 Jekyll 开发的博客创建最近作者列表。

我正在获取最近作者的列表并在 yml 数据中查找每个项目sheet我已经设置了列出每个作者及其简历、姓名和电子邮件等的列表。

我能够提取我想要的信息,但是当它在浏览器中呈现时,它位于 <code> 标记之间。

问题是

{% assign recent_leader = site.data.leaders[dedupped_leader] %}

        {{ recent_leader.name }}
        {{ recent_leader.bio }}

assign 语句似乎导致整个循环内容落入一个代码块中。

如何删除 <code> 标签?我想知道是否只是某处有一个不合适的逗号或...

这是页面的其余代码。

{% comment %}First loop captures leaders from the last three months {% endcomment %}

{% for post in site.posts %}

 {% capture postDateSeconds %}{{post.date | date: "%s"}}{% endcapture %} 
 {% capture siteTimeMinusTwelveWeeks %}{{site.time | date: "%s" | minus: 7260000}}
 {% endcapture %}

{% if postDateSeconds >= siteTimeMinusTwelveWeeks and post.date <= site.time %}
 {% capture indexes %}{{ indexes | append: forloop.index | append: "," }}{% endcapture %}
 {% capture leaders %}{{ leaders | append: post.leader | append: "," }}{% endcapture %}
{% endif %}
{% endfor %}



{% comment %}Split the captured loop into its own array {% endcomment %}

{% assign leaders_array = leaders | split: "," %}


{% comment %} initialise a new array for dedupped list{% endcomment %}

{% assign dedupped_leaders = "" %}

{% comment %} if the leaders name is in the new array already remove it. Then add the name. This makes sure the name is on the list just once. {% endcomment %}

{% for leader in leaders_array %}

{% if dedupped_leaders contains leader %}
{% assign leader_and_comma = leader | append: "," %}
{% capture dedupped_leaders %}{{dedupped_leaders | remove_first: leader_and_comma }}{% endcapture %}
{% endif %}
{% capture dedupped_leaders %}{{dedupped_leaders | append: leader | append: ","}}{% endcapture %}


{% endfor %}


{% comment %}Split the captured loop into its own array {% endcomment %}

{% assign dedupped_leaders_array = dedupped_leaders | split: "," %}

{% for dedupped_leader in dedupped_leaders_array %}

{% assign recent_leader = site.data.leaders[dedupped_leader] %}

        {{ recent_leader.name }}
        {{ recent_leader.bio }}

{% endfor %}
{% assign recent_leader = site.data.leaders[dedupped_leader] %}

        {{ recent_leader.name }}
        {{ recent_leader.bio }}

如果您在 markdown 文件中执行此操作,它将输出代码块 (see kramdown documentation)

如果您不需要代码块,请执行:

非缩进行后没有换行

{% assign recent_leader = site.data.leaders[dedupped_leader] %}
    {{ recent_leader.name }}
    {{ recent_leader.bio }}

两个space缩进

{% assign recent_leader = site.data.leaders[dedupped_leader] %}

  {{ recent_leader.name }}
  {{ recent_leader.bio }}