G_T G_T - 13 days ago 10
HTML Question

Jekyll pagination on multiple pages

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?

Answer

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.