From 5c694655092bbeda4245d706b5929d51a7a588a2 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Mon, 18 Dec 2023 09:58:59 -0800 Subject: [PATCH] Exclude drafts from uploaded builds --- Makefile | 2 +- build.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 50d42f2..46fa1e3 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: * build: - ./build.py out/ + ./build.py out/ --draft pagefind --site out/ clean: diff --git a/build.py b/build.py index 9a204d8..c5dcd4a 100755 --- a/build.py +++ b/build.py @@ -15,6 +15,7 @@ import markdown def main(): parser = argparse.ArgumentParser() parser.add_argument("out", help="output directory") + parser.add_argument("--draft", action="store_true", help="include draft pages") args = parser.parse_args() src = pathlib.Path("src") @@ -123,6 +124,9 @@ def main(): page.header.append(aside) # RSS metadata + if "pubdate" in meta and meta["pubdate"][0] == "draft" and not args.draft: + continue + if "feed" in meta and "pubdate" in meta and meta["pubdate"][0] != "draft": pubdate = datetime.fromisoformat(meta["pubdate"][0]) link = f"https://www.alogoulogoi.com/{dest.relative_to(out).as_posix()}"