我使用Prose.io作为github的CMS。我已将根目录设置为/ _posts。在/ _posts我创建了一个文件夹“staticpages”,它包含一些带文本的markdown文件。我可以循环浏览这些文件吗?我似乎无法弄清楚如何。
所以我的文件树看起来像:
root
|
_posts/
|
staticpages/
|
myfile.md
我想:
{% for pages in posts.staticpages %} {{ page.title }} {% endfor %}
干得好:
在你指定的_config.yml
中
defaults:
- scope:
path: "_posts/staticpages"
values:
static: "true"
并在您的布局文件(或页面)中过滤帖子并循环:
{% assign posts = site.posts | where:"static", "true" %}
{% for post in posts %}...
这对我很有用......
您可以通过在URL中设置文件夹来浏览到该文件夹。如果默认URL为:
然后,您可以在URL中添加分支和文件夹相对路径:
http://prose.io/#<account>/<repository>/tree/master/_posts/staticpages