From 682d1761e75f8f69b22abaffa8d577eccc470452 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Mon, 4 Sep 2023 09:53:43 +0200 Subject: [PATCH] Fixed further regression in blog plugin navigation --- material/plugins/blog/plugin.py | 5 ++++- src/plugins/blog/plugin.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/material/plugins/blog/plugin.py b/material/plugins/blog/plugin.py index 769120cf7..f74d87a8a 100644 --- a/material/plugins/blog/plugin.py +++ b/material/plugins/blog/plugin.py @@ -343,8 +343,11 @@ class BlogPlugin(BasePlugin[BlogConfig]): # view temporarily becomes the main view, and is reset after rendering assert isinstance(view, View) if view != page: + prev = view.pages[view.pages.index(page) - 1] + + # Replace previous page with current page items = self._resolve_siblings(view, nav) - items[items.index(view)] = page + items[items.index(prev)] = page # Render excerpts and prepare pagination posts, pagination = self._render(page) diff --git a/src/plugins/blog/plugin.py b/src/plugins/blog/plugin.py index 769120cf7..f74d87a8a 100644 --- a/src/plugins/blog/plugin.py +++ b/src/plugins/blog/plugin.py @@ -343,8 +343,11 @@ class BlogPlugin(BasePlugin[BlogConfig]): # view temporarily becomes the main view, and is reset after rendering assert isinstance(view, View) if view != page: + prev = view.pages[view.pages.index(page) - 1] + + # Replace previous page with current page items = self._resolve_siblings(view, nav) - items[items.index(view)] = page + items[items.index(prev)] = page # Render excerpts and prepare pagination posts, pagination = self._render(page)