aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-04-27 08:31:22 -0600
committerMelody Horn <melody@boringcactus.com>2021-04-27 08:31:22 -0600
commitb7a303668ed4c0caf450313e5ea9851117abfffe (patch)
tree19ec3d399e87266aeee00f0c8d048f03050ba482
parent8dd7786d99976f3ae6bed9873a7a7759d59f0912 (diff)
downloadcactus-ssg-b7a303668ed4c0caf450313e5ea9851117abfffe.tar.gz
cactus-ssg-b7a303668ed4c0caf450313e5ea9851117abfffe.zip
allow posts to be unlisted
-rw-r--r--build.py7
1 files 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)