From ef5a04a3243835a053a6b5b8a96badb5f910863e Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 13 Sep 2023 22:05:53 +0200 Subject: [PATCH] Fixed draft blog posts being included in navigation --- material/plugins/blog/plugin.py | 7 +++---- src/plugins/blog/plugin.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/material/plugins/blog/plugin.py b/material/plugins/blog/plugin.py index 634c57f2f..4f4d9c69c 100644 --- a/material/plugins/blog/plugin.py +++ b/material/plugins/blog/plugin.py @@ -134,10 +134,6 @@ class BlogPlugin(BasePlugin[BlogConfig]): reverse = True ) - # Temporarily remove posts from navigation - for post in self.blog.posts: - post.file.inclusion = InclusionLevel.EXCLUDED - # Generate views for archive if self.config.archive: views = self._generate_archive(config, files) @@ -460,6 +456,9 @@ class BlogPlugin(BasePlugin[BlogConfig]): if not file.src_path.startswith(path): continue + # Temporarily remove post from navigation + file.inclusion = InclusionLevel.EXCLUDED + # Resolve post - in order to determine whether a post should be # excluded, we must load it and analyze its metadata. All posts # marked as drafts are excluded, except for when the author has diff --git a/src/plugins/blog/plugin.py b/src/plugins/blog/plugin.py index 634c57f2f..4f4d9c69c 100644 --- a/src/plugins/blog/plugin.py +++ b/src/plugins/blog/plugin.py @@ -134,10 +134,6 @@ class BlogPlugin(BasePlugin[BlogConfig]): reverse = True ) - # Temporarily remove posts from navigation - for post in self.blog.posts: - post.file.inclusion = InclusionLevel.EXCLUDED - # Generate views for archive if self.config.archive: views = self._generate_archive(config, files) @@ -460,6 +456,9 @@ class BlogPlugin(BasePlugin[BlogConfig]): if not file.src_path.startswith(path): continue + # Temporarily remove post from navigation + file.inclusion = InclusionLevel.EXCLUDED + # Resolve post - in order to determine whether a post should be # excluded, we must load it and analyze its metadata. All posts # marked as drafts are excluded, except for when the author has