我有一些液体标记在我_includes/
的机器上渲染得很好,但是当我只推送到gh-pages
包含的 div 渲染时。它应该为我的网站生成导航,按页面类别分组。我已经在我的机器上匹配了 rubygems 来模仿我在这里看到的内容。我的流动语法有什么问题会阻止它在 GitHub Pages 中呈现吗?
<!-- NAVBAR -->
<div class="navbar">
{% assign categories = site.pages | map: 'to_liquid' | map: 'category' %}
{% assign usedCategories = '' %}
{% for category in categories %}{% if category %}
{% capture categoryToCheck %},{{ category }},{% endcapture %}
{% unless usedCategories contains categoryToCheck %}
<h3 style="color: red; text-transform: capitalize;">{{ category | replace: '-', ' ' }}</h3>
{% for doc in site.pages %}{% if doc.category == category %}
<a href="{{ site.baseurl }}{{ doc.url }}">{{ doc.title }}</a>
{% endif %}{% endfor %}
{% capture usedCategories %}{{ usedCategories }}{{ categoryToCheck }}{% endcapture %}
{% endunless %}
{% endif %}{% endfor %}
</div>
注意:我认为我已经将问题归结map: 'category'
为site.pages | map: 'to_liquid'
生成相同的输出(但顺序不同)。map: 'category'
在我的机器上从液体中提取字段,但这gh-pages
不会发生。如果您有任何建议,请告诉我!