如何将博客(blog.html)添加到我的非博客" jekyll"网站(index.html)?

时间:2017-11-12 16:08:57

标签: twitter-bootstrap jekyll blogs

情况:

我从一个引导模板开始使用一个滚动网站。

我已经想过如何添加另一个页面&在主页和第二页之间导航。现在我想在第二页上建立一个博客。

到目前为止,我只看过教程,向您解释如何根据index.html建立一个博客主题的jekyll博客。

然而

现在我想从blog.html建立一个博客如果我希望我的博客页面看起来像这样,我该从哪里开始?  https://blackrockdigital.github.io/startbootstrap-blog-post/?#

主要问题

如何将2017-11-12-first_post.md从根_posts链接到blog.html

网站链接: http://werkbaar.net/

链接到回购: https://github.com/bomengeduld/boilerplate

1 个答案:

答案 0 :(得分:1)

在博客布局中,您应该遍历帖子,如下所示:

{% for item in site.posts %}
  {{ item.title }}
{% endfor %}

在blog.md文件的前端链接新布局,如下所示:

---
title: Blog
layout: blog
---

布局是一个名为blog.html的文件,应该放在_layouts目录中。 blog.md文件应放在项目的根目录中。

如果您只想展示第一篇文章,请使用limit:1

{% for item in site.posts limit:1 %}
  {{ item.title }}
{% endfor %}
相关问题