Skip to content

Commit 4915cd9

Browse files
authored
Merge pull request #149 from Guts/feature/ignore-drafts
Feature: ignore pages with draft:true in meta
2 parents 8a3a03a + c1e4d5c commit 4915cd9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

mkdocs_rss_plugin/plugin.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ def on_page_content(
212212
if not self.match_path_pattern.match(page.file.src_path):
213213
return
214214

215+
# skip pages with draft=true
216+
if page.meta.get("draft", False) is True:
217+
logger.debug(f"Page {page.title} ignored because it's a draft")
218+
return
219+
215220
# retrieve dates from git log
216221
page_dates = self.util.get_file_dates(
217222
in_page=page,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Page with partial meta but draft
3+
draft: true
4+
---
5+
6+
# Test page with partial meta but draft
7+
8+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

0 commit comments

Comments
 (0)