From b7a303668ed4c0caf450313e5ea9851117abfffe Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Tue, 27 Apr 2021 08:31:22 -0600 Subject: allow posts to be unlisted --- build.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index e3d0387..b555931 100644 --- a/build.py +++ b/build.py @@ -24,6 +24,7 @@ class Page: excerpt: str url: str date: typing.Optional[date] + listed: bool raw_content: str html_content: str @@ -57,6 +58,7 @@ class Page: if permalink.endswith('/'): permalink = permalink + 'index' dest = Path(permalink) + listed = 'unlisted' not in front_matter if template_context is not None: content = Template(content) @@ -65,7 +67,7 @@ class Page: html_content = markdown(content) gmi_content = md2gemini(content, links='copy', md_links=True).replace('\r\n', '\n') - return Page(title, description, excerpt, str(dest).replace('\\', '/'), page_date, + return Page(title, description, excerpt, str(dest).replace('\\', '/'), page_date, listed, content, html_content, gmi_content) def describe(self): @@ -160,7 +162,8 @@ def main(): print(' -', post_filename.name) page = Page.load(post_filename) render(site_dir, page) - posts.append(page) + if page.listed: + posts.append(page) posts.sort(key=lambda x: x.date, reverse=True) -- cgit v1.2.3