Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: ignore pages with draft:true in meta #149

Merged
merged 2 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.