~boringcactus/cactus-ssg

b7a303668ed4c0caf450313e5ea9851117abfffe — Melody Horn 2 years ago 8dd7786
allow posts to be unlisted
1 files changed, 5 insertions(+), 2 deletions(-)

M build.py
M build.py => build.py +5 -2
@@ 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)