middleman-blog
middleman-blog copied to clipboard
Pagination on root index.html page
Hiya
Trying to put pagination on the home page of my site:
Please see Gist for code so far: https://gist.github.com/iwarner/9884f2aee164ebc57dc2 - its really the next and previous links that are the issue, using the standard code.
The Next Link is changed to the following and works fine. http://localhost:4567/page/2/index.html
But this breaks the rule in the docs
should it now be : http://localhost:4567/page/2.html or http://localhost:4567/index/page/2.html
Now I have created a pagination
PREV - 1 - 2 - 3 - 4 - NEXT
So the rules for my links to individual pages follow the rule I expect and so break they all link to http://localhost:4567/index/page/2.html
Any help appreciated
Many thanks
Ian
Please also share your config.rb
. You can add it to the same gist.
Thx added
Beautified gist with code and configuration: https://gist.github.com/lolmaus/13314995b326be27c957
So you've got directory indexes disabled?
Try setting blog.page_link
to "page/{num}"
and page/{num}.html
, does this change anything?
Thx for the gist example - looks better for sure - will try the suggestion ASAP
Many thanks
Result in testing Next and Previous Links:
- page/{num} = http://localhost:8080/page/2/index.html
- page/{num}.html = http://localhost:8080/page/2.html/index.html
I will start a brand new project now and test code on index page of that also.
Ok this is important:
I had set :strip_index_file, false
and page/{num}
When set to true the rest of links are more functional - so the issue is around using strip index false on the home page. The next and previous will work but will distort the general pattern of pagination
LOL hard to explain this.
Seems like strip_index_file
and pagination don't get along well.
Hiya yeah I will have to put workarounds in, affects breadcrumbs etc also. Basically anything that relies on paths.
Will investigate and feedback with code on how I solved these.
Thanks