每页上的Jekyll分页 [英] Jekyll Pagination on every page

查看:172
本文介绍了每页上的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.

这篇关于每页上的Jekyll分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆