Jekyll在多页上分页 [英] Jekyll pagination on multiple pages

查看:239
本文介绍了Jekyll在多页上分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对html / css是新手,但我试图用Jekyll创建一个博客,并且在这里找到了这个主题 https: //github.com/rosario/kasper



主页index.html包含分页列表中的所有帖子。这很酷。不过,我想将我的帖子分组到不同的类别中,并为每个组添加一个附加页面,这些页面将包含该分组的简单帖子的分页列表。



我可以创建这些额外的页面,但无法使用index.html中任何类型的代码变体,但指定一个组。



这可能吗?

解决方案

如果您需要更详细的问题答案,您应该与您的答案分享您的代码。据我了解,您在创建一系列属于同一类别的博客帖子时遇到问题。如果这是正确的,那么你可以通过使用液体循环来达到目的。如果你看看你的index.html上的代码,它有这个循环

  {%for post in paginator.posts%} 

如果您像下面那样修改它

 {%for site.categories.comedy%中的帖子} 

其中喜剧是一个类别名称。通过这种方式,我们访问站点对象中的类别并获取该类别下的所有帖子。如果在更改类别名称时在单独的页面上放置类似的循环,则可以在不同的页面上使用不同的类别列表。确保你在你的文章的前端内容中正确地输入了类别名称。如果我成功回答您的问题,请将答案标为正确。

I am new to html/css but am attempting to create a blog using Jekyll and this theme I found here https://github.com/rosario/kasper

The homepage index.html has the all the posts in a paginated list. This is cool. However i would like to group my posts into different categories and have an additional page for each group which would have a paginated list of just posts of that groups.

I can create the additional pages but can't get the lists using any sort of variant of the code in index.html but specifying a group.

Is this possible?

解决方案

You should share your code with your answer if you want a more detailed answer for your question. As far as I understood you are having trouble with creating a list of blog posts that are all same category. If this is correct then you can achieve it by using liquid for loop. If you look into the code on your index.html it has this for loop

{% for post in paginator.posts %}

If you modify it like below

{% for post in site.categories.comedy %}

Where comedy is a category name. This way we access the category within the site object and get all the posts under this category. If you place similar loops on your separate pages while changing the category names you can have different category lists on different pages. Make sure that you correctly input the category names in your post's front matter. If I succeeded in answering your question please mark the answer as correct.

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

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