Fixed further regression in blog plugin navigation

This commit is contained in:
squidfunk 2023-09-04 09:53:43 +02:00
parent 752aa5ce88
commit 682d1761e7
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
2 changed files with 8 additions and 2 deletions

View File

@ -343,8 +343,11 @@ class BlogPlugin(BasePlugin[BlogConfig]):
# view temporarily becomes the main view, and is reset after rendering # view temporarily becomes the main view, and is reset after rendering
assert isinstance(view, View) assert isinstance(view, View)
if view != page: if view != page:
prev = view.pages[view.pages.index(page) - 1]
# Replace previous page with current page
items = self._resolve_siblings(view, nav) items = self._resolve_siblings(view, nav)
items[items.index(view)] = page items[items.index(prev)] = page
# Render excerpts and prepare pagination # Render excerpts and prepare pagination
posts, pagination = self._render(page) posts, pagination = self._render(page)

View File

@ -343,8 +343,11 @@ class BlogPlugin(BasePlugin[BlogConfig]):
# view temporarily becomes the main view, and is reset after rendering # view temporarily becomes the main view, and is reset after rendering
assert isinstance(view, View) assert isinstance(view, View)
if view != page: if view != page:
prev = view.pages[view.pages.index(page) - 1]
# Replace previous page with current page
items = self._resolve_siblings(view, nav) items = self._resolve_siblings(view, nav)
items[items.index(view)] = page items[items.index(prev)] = page
# Render excerpts and prepare pagination # Render excerpts and prepare pagination
posts, pagination = self._render(page) posts, pagination = self._render(page)