Commit 5e73a2c1 authored by Marien Fressinaud's avatar Marien Fressinaud

add: Support private articles

parent 5ccb6604
......@@ -59,6 +59,9 @@ class Article:
site_timezone = self.meta.get("SITE_TIMEZONE", "UTC")
return pytz.timezone(site_timezone)
def is_private(self):
return self.meta.get("ARTICLE_PRIVATE", False)
def date(self):
if "ARTICLE_DATE" not in self.meta:
return datetime.datetime.now(tz=self.timezone())
......
......@@ -48,6 +48,7 @@ def build_page_from_filepath(filepath, configuration, basename=None, slug=None):
def build_blog_page(articles, series, configuration):
articles = [article for article in articles if not article.is_private()]
articles.sort(key=lambda article: article.date(), reverse=True)
series.sort(key=lambda serie: serie.title(), reverse=False)
......@@ -109,6 +110,9 @@ def write_feed(feed, output_path):
)
for article in articles:
if article.is_private():
continue
entry = {
"title": article.title(),
"id": f"urn:uuid:{article.uuid()}",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment