开发者

How to use Loop in Jekyll

开发者 https://www.devze.com 2023-03-25 02:39 出处:网络
Suppose I have a directory and file structure as shown below in the jekyll for creating the static site. In this case how can I make a loop for the dev directory so that each time i can get the conten

Suppose I have a directory and file structure as shown below in the jekyll for creating the static site. In this case how can I make a loop for the dev directory so that each time i can get the content of the *.md file

static-site
       |
   开发者_StackOverflow中文版     content
         |
        dev
         |
          test1.md
          test2.md
          text3.md


locate your *.md content in your _posts folder (sub dir is fine) and then call your content with something like:

{% for post in site.categories.dev %}

{{ post.content }}

{% endfor %}

be sure to include the "dev" category to your yaml front matter.

0

精彩评论

暂无评论...
验证码 换一张
取 消