middleman-blog icon indicating copy to clipboard operation
middleman-blog copied to clipboard

Pagination on root index.html page

Open iwarner opened this issue 10 years ago • 8 comments

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

iwarner avatar Feb 18 '15 11:02 iwarner

Please also share your config.rb. You can add it to the same gist.

lolmaus avatar Feb 18 '15 12:02 lolmaus

Thx added

iwarner avatar Feb 18 '15 14:02 iwarner

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?

lolmaus avatar Feb 18 '15 14:02 lolmaus

Thx for the gist example - looks better for sure - will try the suggestion ASAP

Many thanks

iwarner avatar Feb 18 '15 15:02 iwarner

Result in testing Next and Previous Links:

  1. page/{num} = http://localhost:8080/page/2/index.html
  2. 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.

iwarner avatar Feb 18 '15 15:02 iwarner

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.

iwarner avatar Feb 18 '15 15:02 iwarner

Seems like strip_index_file and pagination don't get along well.

tdreyno avatar Feb 18 '15 17:02 tdreyno

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

iwarner avatar Feb 18 '15 18:02 iwarner