The issue: You can click on ‘Older’ to get to the second page of older blog posts (please see button in the bottom right of bgigurtsis dot com/blog/). However, clicking on ‘Newer’ once on that second page takes you to the homepage, as opposed to the page you were just on listing the newer blog posts.
I’ve made this GIF to illustrate the issue: https://i.imgur.com/JN9qXoN.gif
My setup I’m using a Jekyll theme hosted on AWS Amplify. Usually for this theme the index page is where all the blog posts are. I changed this so the index page is a ‘welcome’ post with a hyperlink to the blog instead.
To achieve this:
- I moved index.html (pagination code) from my root dir into a folder called ‘blog’
- Added an index.md (welcome page) in my root directory.
- Added this code to my _config.yml: paginate_path: “/blog/page:num”
Here’s the folder structure:
├── index.md (welcome post)
------ ├── index.html (paginate code)
------ ├── post1.md
------ ├── post2.md
------ ├── post3.md
------ ├── post4.md
------ ├── post5.md
My _config.yml build settings:
# Build settings markdown: kramdown redcarpet: extensions: ['smart', 'tables', 'with_toc_data'] permalink: /blog/:title paginate_path: "/blog/page:num" paginate: 4 sass: style: compressed plugins: - jekyll-paginate - jekyll-sitemap
Here is the frontmatter for blog/index.html
--- layout: default ---
The homepage for my blog is here bgigurtsis dot com
The repistory for the blog is here bgigurtsis/blog
Pagination links the button “Older” to my homepage instead of the first page of my blog. It seems like pagination dosen’t know that bgigurtsis dot com/blog is the first page of blog posts but i’m not sure how to fix this. Any ideas? Thanks!