Create a page for every category


#1

In the Jekyll we generally organised the blogs with the categories.

But how we can create a separate page, in which if we click on business categories then only business related blogs post should be listed.

In which folder we have to create the folder?


#2

I am not aware if this feature is included in the latest jekyll release. A little while ago I created my own solution for this. You can take a look at my theme: classic-jekyll-theme to see how I did it exactly.

The short of it is: create a layout that generates the page, and then create ‘pseudo’ pages to trigger the generation process.

These pseudo pages only need to contain some yaml like:

---
layout: category-page
title: classic
---

This would create a page of all posts in the "classic’ category.
For the generation of the page itself, please take a look at the theme.


#3

Do I need to write this content in the _layout folder by create a new .html file.
Right?


#4

No. Please take a look at my theme. The following information applies to the CLASSIC-JEKYLL-THEME only! (I.e. not to the default Jekyll theme ‘minima’)!!

In the _layouts folder there is a file called category-page.html

This file creates a category page of all posts that refer to a category.

To trigger the generation of a category page you need another file (for example in a pages directory) that specifies the layout generator category-page and specifies for which category it should generate a page. The yaml title is used for the category page.

Please keep in mind that you need my Classic-Jekyll-Theme for this to work.

The reason why I am posting this to point you to an example that can generate category pages. But you will still have to write the generator yourself. Or use my theme :wink:


#5

Does jekyll can create pages for each category automatically?