Skip to content

Commit

Permalink
Merge pull request #149 from Guts/feature/ignore-drafts
Browse files Browse the repository at this point in the history
Feature: ignore pages with draft:true in meta
  • Loading branch information
Guts authored Oct 13, 2022
2 parents 8a3a03a + c1e4d5c commit 4915cd9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mkdocs_rss_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ def on_page_content(
if not self.match_path_pattern.match(page.file.src_path):
return

# skip pages with draft=true
if page.meta.get("draft", False) is True:
logger.debug(f"Page {page.title} ignored because it's a draft")
return

# retrieve dates from git log
page_dates = self.util.get_file_dates(
in_page=page,
Expand Down
8 changes: 8 additions & 0 deletions tests/fixtures/docs/page_with_meta_draft_true.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Page with partial meta but draft
draft: true
---

# Test page with partial meta but draft

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 comments on commit 4915cd9

Please sign in to comment.