Skip to content

Commit ef5a04a

Browse files
committed
Fixed draft blog posts being included in navigation
1 parent ae93496 commit ef5a04a

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

material/plugins/blog/plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ def on_files(self, files, *, config):
134134
reverse = True
135135
)
136136

137-
# Temporarily remove posts from navigation
138-
for post in self.blog.posts:
139-
post.file.inclusion = InclusionLevel.EXCLUDED
140-
141137
# Generate views for archive
142138
if self.config.archive:
143139
views = self._generate_archive(config, files)
@@ -460,6 +456,9 @@ def _resolve_posts(self, files: Files, config: MkDocsConfig):
460456
if not file.src_path.startswith(path):
461457
continue
462458

459+
# Temporarily remove post from navigation
460+
file.inclusion = InclusionLevel.EXCLUDED
461+
463462
# Resolve post - in order to determine whether a post should be
464463
# excluded, we must load it and analyze its metadata. All posts
465464
# marked as drafts are excluded, except for when the author has

src/plugins/blog/plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@ def on_files(self, files, *, config):
134134
reverse = True
135135
)
136136

137-
# Temporarily remove posts from navigation
138-
for post in self.blog.posts:
139-
post.file.inclusion = InclusionLevel.EXCLUDED
140-
141137
# Generate views for archive
142138
if self.config.archive:
143139
views = self._generate_archive(config, files)
@@ -460,6 +456,9 @@ def _resolve_posts(self, files: Files, config: MkDocsConfig):
460456
if not file.src_path.startswith(path):
461457
continue
462458

459+
# Temporarily remove post from navigation
460+
file.inclusion = InclusionLevel.EXCLUDED
461+
463462
# Resolve post - in order to determine whether a post should be
464463
# excluded, we must load it and analyze its metadata. All posts
465464
# marked as drafts are excluded, except for when the author has

0 commit comments

Comments
 (0)