I’m still learning the Jekyll environment and yet facing an issue on how to implement pagination in a website. Although it seems to be an easy issue, I don’t think it is (at least for me haha).
We want to implement pagination only in the blog, we use three builds of Jekyll to generate our website, one for the root website ‘domain/’, one for documentation ‘domanin.com/doc’ and finally, one for ‘/blog/’.
I configured the config.yml file as this:
paginate: 6 paginate_path: "/blog/:num/"
We didn’t have a index file in the root of the project, so it was throwing an error:
Pagination: Pagination is enabled, but I couldn’t find an index.html page to use as the pagination template. Skipping pagination.
This happened because we had the blog page being generated in the folder /pages/blog/index.html.
The way we fixed was to create the index.html file (of course) in the root of the directory, but it generates the first page of the blog as ‘domain/index.html’ and if we deploy as this, it will create a conflict with the main website, that are using that adress. The pagination are being generated correctly, /blog/2 and so on.
What I though as a possible solution was to set a permalink in the frontmatter of the index file as ‘/blog’, but it doesn’t work.
The question is: is there a way to generate the first page of the blog inside the /blog folder and not in the root?