开发者

How to use Loop in Jekyll

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜