The way to have two or more Jekyll blogs in your Git Pages website
I wanted to split my blog into two separate blogs, one for my technology articles and one for everyday tips and tricks, so I searched for a way to do that on my Jekyll website which is hosted on a Git Page on GitHub.
Unfortunately Git Pages do not support the version 2.0 of the jekyll paginate plugin which would allow me to split the posts into Categories and iterate on each blog over a specific category.
Here are the steps I followed to solve this problem:
-
First of all you will have to add a new folder on the root of your website (on the same level as the
_posts
folder). You can name this folder the way you want. For this example lets say its XXX. This name will be also shown on the URL of your second blog:your_domain/XXX/your_post_title
. -
Inside the XXX folder add another one named
_posts
. -
Create a new article and add it in the new
XXX\_posts
folder. -
Mark the article you do not want to show on your main blog with the
hidden: true
property. This will hide it when you iterate withpaginator.posts
over all your articles. -
Create a new XXX.html page with the same name you used for the name of the folder of step 1 and add it on the root of your website.
-
Inside this html page you can now iterate over categories, which is not the categories of paginator but of Jekyll, like this:
for post in site.categories.XXX
.
You can repeat the previous 5 steps to create even more than two blogs in a Jekyll website hosted on Git Pages.