jekyll-paginate-v2 icon indicating copy to clipboard operation
jekyll-paginate-v2 copied to clipboard

First Paginated Page Url with Index.html even if I set Permalink Pretty in my config.yml

Open simduchaine opened this issue 7 years ago • 9 comments

I try to have an url of http://localhost:4000/blogue/ on my first paginated page, but I get http://localhost:4000/blogue/index.html even if I set permalink: pretty in config.yml.

I've tried to force the permalink using the front-matter permalink variable but the issue still persist.

simduchaine avatar Jun 27 '18 12:06 simduchaine

A hack, but it gets the job done...

<a href="{{ paginator.next_page_path | remove_first: 'index.html' }}" class="next">Next</a>

joshgoebel avatar Dec 12 '18 00:12 joshgoebel

https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md#renaming-pagination-file-names

Seems this works out of the box now, perhaps your config is setting indexpage when it should be leaving it nil?

joshgoebel avatar Dec 12 '18 01:12 joshgoebel

I have been having this issue as well with site.html_pages links to a page with pagination enabled, as well as the paginator.page_trail paths, though the paginator next_page_path and previous_page_path values do not seem to exhibit the problem for me at least. The hack provided by @yyyc514 seems to work fine as well, though it would be nice if that was not needed.

As a note my permalink structure for the site is permalink: /:collection/:title/ and permalink: '/page/:num/' for pagination.

presentfactory avatar Dec 30 '18 00:12 presentfactory

@yyyc514 Thanks for your solution.

I think to be more flexible we can do it like below

 {% capture index_page_name %}{{ site.pagination.indexpage }}.{{ site.pagination.extension }}{% endcapture %}
<a href="{{ paginator.next_page_path | remove_first: index_page_name }}" class="next">Next</a>

lanzhiheng avatar Oct 09 '19 11:10 lanzhiheng

I'd like to add that now since I have updated to Jekyll 4.0.0 this happens with generic link tags as well, so something like {% link foo.html %} where that page has pagination enabled will generate an incorrect link with the trailing index.html on it.

This may be due to how they changed the link tag to automatically prepend the site's baseurl or something (since that was one of the breaking changes in version 4), but that's just a guess.

presentfactory avatar Jan 28 '20 08:01 presentfactory

Could you please upgrade to https://rubygems.org/gems/jekyll-paginate-v2/versions/3.0.0 and test again for me?

sverrirs avatar Feb 08 '20 00:02 sverrirs

@sverrirs I upgraded to 3.0.0 and it seems to have broken a number of things. Now doing something like {% link foo.html %} if that page has pagination enabled on it simply causes an error as it cannot find the file. Secondly paginated pages oddly don't appear in site.html_pages anymore, only site.pages, which is not the worst thing ever, but the urls to the pages still have index.html on them regardless of the permalink settings. Finally something else seems to have broken as now all the paginated pages for different collections seem to be using the posts.html file to display their paginated content which is very strange considering it's a completely different file than what is being requested. For example I have two files, posts.html which lists all the posts and projects.html which displays all the projects. The main difference between these two is a header which says if it's posts or projects being displayed but for both it says posts when served despite being different pages, implying that they are both using the posts.html file to render their paginated content for some reason.

presentfactory avatar Feb 08 '20 14:02 presentfactory

@presentfactory Is there any difference if you use Jekyll 3.8.6 ? (I'm assuming that you're using Jekyll 4.0.0 here).

ashmaroli avatar Feb 08 '20 14:02 ashmaroli