jekyll / jekyll-paginate

NO LONGER UNDER ACTIVE DEVELOPMENT as of Jekyll 3: Pagination Generator for Jekyll
MIT License
111 stars 84 forks source link

GithubPage Posts page works only with an ending / #40

Open davideghz opened 6 years ago

davideghz commented 6 years ago

Hi, I know this plugin is no longer maintained, but since the new paginate-v2 is not supported by github pages, I hope to get some assistance here :)

My site's structure is pretty straightforward, with the paginated list of posts under the path :root/posts. I achieved that with the following setup:

files tree

.
├── index.md
├── _layouts
│   ├── default.html
│   ├── home.html
│   ├── post.html
│   └── posts.html
├── posts
│   └── index.html
├── _posts
│   ├── 1986-08-01-hello-world.md
│   ├── 2017-03-09-welcome-to-jekyll.md
│   └── 2018-04-18-today.md
├── posts.md
...

_config.yml

# Plugins
plugins:
  - jekyll-paginate

# Permalinks
permalink: :title:output_ext

# Pagination
paginate: 2
paginate_path: "/posts/page:num"

In my local environment when I browse localhost:4000/posts I get redirected to localhost:4000/posts/ (note the ending /) and paginator works just fine.

On my live website when I browse davideghezzi.com/posts I don't get redirected and the paginator does not work. If I manually browse davideghezzi.com/posts/ (with the ending /) it works.

How can I address this issue?

p.s. you can find source code here https://github.com/davideghz/davideghz.github.io

davideghz commented 6 years ago

Well, maybe not the most elegant solution, neither the best SEO oriented solution, but I got it working with:

Gemfile

group :jekyll_plugins do
  ...
  gem "jekyll-redirect-from"
end

_config.yml

plugins:
  - jekyll-redirect-from

posts.md

---
layout: posts
redirect_to:
  - /posts/
---

Pls let me know if you know better solutions