每页上的Jekyll分页

问题描述:

我们知道Jekyll的默认分页仅支持index.html,我想在其中创建blog.html包含分页.

As we know Jekyll default pagination just support for index.html, and I want to create blog.html include pagination there.

有什么解决办法吗?

如果创建一个名为/blog的目录并在其中放置index.html文件,则可以在_config.yml中添加一个表示paginate_path: "blog/page:num".而不是使用根文件夹中的默认index.html作为分页模板,而是使用/blog/index.html.分页器将根据需要生成类似/blog/page2//blog/page3/的页面.

If you create a directory called /blog and place an index.html file inside there, then you can add a setting to the _config.yml that says paginate_path: "blog/page:num". Instead of using the default index.html in your root folder as the paginator template, this will use /blog/index.html. The paginator will generate pages like /blog/page2/ and /blog/page3/ as needed.

这将使您进入yourwebsite.com/blog,但是如果要进入yourwebsite.com/blog.html,则可能必须使用重定向.

This will get you to yourwebsite.com/blog, but if you want to get to yourwebsite.com/blog.html you'll probably have to use a redirect.