You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When there is three or more pages of latest posts on the blog, some of the pagination links at the bottom of the page are wrongly generated from page 3 onward.
Navigate to /blog/, go to the bottom of the page, observe by hovering and looking in the browser status bar or using developer tools that the links to pages 2, 3, and 4 are correct
Navigate to /blog/page/2/, observe that the links to pages 1, 3, and 4 are correct
Navigate to /blog/page/3/, observe that the links to pages 1 and 4 are correct, while the link to page 2 is actually the link to page 1
Navigate to /blog/page/3/, observe that the links to page 1 is correct, while the links to page 2 and 3 are actually the links to page 1 as well
Thanks for reporting. It's definitely related to the changed we introduced to fix #5952. Reverting that change fixes it I will check and see how we can make both things work.
Fixed in c2da2d8. Okay, so this took longer than expected, but I think I finally have a better solution for this.
The blog plugin implements pagination as a special type of page, which can contain paginated views of themselves. When those pages are rendered in the navigation, the currently active page should appear as the same navigation item as the first page. To support this, I had to jump through some hoops, namely replacing the top-level page when rendering a paginated view. This led to many problems and workarounds, all of which we tried to fix in the past, but there where always new edge cases that made this tricky to get right.
This commit takes another approach: it leaves the navigation structure as it is, and implements pagination in template land. Turns out, you only need 5 lines of Jinja to support this and make the entire logic much simpler and less fragile. The only thing we need to implement is to replace links from a paginated view to itself with a link to the first page. If we wouldn't do that, clicking on the navigation item when paginating would lead you to the same page, but IMHO the expected outcome is navigation to the first page. I've also tested previously reported issues, including #5952, and it seems that this new approach seems to not break anything we fixed in the past. Best thing: we replaced 30 lines with 5.
Context
No response
Bug description
When there is three or more pages of latest posts on the blog, some of the pagination links at the bottom of the page are wrongly generated from page 3 onward.
Related links
Reproduction
9.4.10-latest-posts-pagination-links.zip
Steps to reproduce
mkdocs serve
in the minimal example/blog/
, go to the bottom of the page, observe by hovering and looking in the browser status bar or using developer tools that the links to pages 2, 3, and 4 are correct/blog/page/2/
, observe that the links to pages 1, 3, and 4 are correct/blog/page/3/
, observe that the links to pages 1 and 4 are correct, while the link to page 2 is actually the link to page 1/blog/page/3/
, observe that the links to page 1 is correct, while the links to page 2 and 3 are actually the links to page 1 as wellBrowser
No response
Before submitting
The text was updated successfully, but these errors were encountered: