【问题标题】:How to add a blog (blog.html) to my nonblog "jekyll" website (index.html)?如何将博客 (blog.html) 添加到我的非博客“jekyll”网站 (index.html)?
【发布时间】:2017-11-12 16:08:56
【问题描述】:

情况:

我从一个引导模板的单滚动网站开始。

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

到目前为止,我只看到了一些教程,这些教程解释了如何设置一个带有博客主题的 jekyll 博客,来自 index.html。

还是

现在我想从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

【问题讨论】:

  • 只需添加一个新菜单项并将其链接到 blog.html

标签: twitter-bootstrap jekyll blogs


【解决方案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 %}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    • 2021-07-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多