首页 > 解决方案 > 如何配置 Jekyll 让 /blog 并排放置帖子和静态页面

问题描述

我需要在 /blog 目录中建立一个包含静态页面和博客的网站。我有一个带有 index.html 的自定义网站,它是主要入口点,我想在导航栏中添加 /blog。

到目前为止,我有这个:

_config.yaml

permalink: "/blog/:title.html"

plugins: [jekyll-paginate]
paginate: 10
paginate_path: "/blog/page:num"

博客.md:

---
layout: default
title: LIPS Blog
permalink: /blog/
---
<p>This is blog</p>
{% for post in paginator.posts %}
<article>
  <header>
    <h2><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h2>
  </header>
  <div class="excerpt">
    {{ post.content | split: '<!-- more -->' | first }}
  </div>
</article>
{% endfor %}

我在_posts中有两个文件:

2020-11-22-web-worker-and-scheme-lisp.md
2021-05-01-LIPS-parser.md

/blog 已呈现,但分页器不起作用。我有一个警告:

分页:分页已启用,但我找不到 index.html 页面用作分页模板。跳过分页。

如何在 /blog 目录中为带有分页的帖子设置 Jekyll?

标签: jekyll

解决方案


推荐阅读