liquid - Loop trough files in _posts subfolder - Jekyll -
i using prose.io cms github. in have set root directory /_posts. in /_posts have made folder "staticpages", contains markdown files text. can loop trough these files? can't seem figur out how.
so file tree looks like:
root | _posts/ | staticpages/ | myfile.md
and want to:
{% pages in posts.staticpages %} {{ page.title }} {% endfor %}
here go:
in _config.yml
specify
defaults: - scope: path: "_posts/staticpages" values: static: "true"
and in layout file (or page) filter posts , loop with:
{% assign posts = site.posts | where:"static", "true" %} {% post in posts %}...
this works me...
Comments
Post a Comment