【发布时间】:2018-01-09 18:37:00
【问题描述】:
短版:
为什么navbox.next_article是字符串'2018-01-05-man-command'时下面的代码没有输出?!
{% capture np %} {{ site.posts | where:"post","navbox.next_article contains post.title" }} {% endcapture %}
The next post is {{ np.title }}
详情
我的帖子2018-01-05-man-command.md 有一个 YAML 前题:
---
layout : post
title : 'Man Command'
tags : [RHCSA, RHCSA_mod, Using Essential Tools, Man Command]
categories: [RHCSA]
navbox:
# prev_article:
next_article: 2018-01-05-understanding-globbing-and-wildcards
---
_includes/post.html 文件通过以下方式访问:
{% unless include.excerpt %}
{{ post.content }}
{% include navbox.html navbox=page.navbox %}
{% endunless %}
_layout/post.html 使用它来设置帖子的布局:
{% include post.html post=page link_title=false %}
我的navbox.html 包含:
{% assign navbox = include.navbox %}
{% capture np %} {{ site.posts | where:"post","navbox.next_article contains post.title" }} {% endcapture %}
The next post is {{ np.title }}
但是,当我运行 bundle exec jekyll serve 时,我得到的只是:
下一篇是
为什么这条线不起作用?我是 jekyll 的新手,所以我可能在大多数人都直观的地方犯了一个错误。请告诉我我能解决什么问题。
【问题讨论】:
标签: html jekyll liquid github-pages