1
0
Fork 0

Exclude drafts from uploaded builds

This commit is contained in:
Tim Van Baak 2023-12-18 09:58:59 -08:00
parent bf7e19ad61
commit 5c69465509
2 changed files with 5 additions and 1 deletions

View File

@ -1,7 +1,7 @@
.PHONY: * .PHONY: *
build: build:
./build.py out/ ./build.py out/ --draft
pagefind --site out/ pagefind --site out/
clean: clean:

View File

@ -15,6 +15,7 @@ import markdown
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("out", help="output directory") parser.add_argument("out", help="output directory")
parser.add_argument("--draft", action="store_true", help="include draft pages")
args = parser.parse_args() args = parser.parse_args()
src = pathlib.Path("src") src = pathlib.Path("src")
@ -123,6 +124,9 @@ def main():
page.header.append(aside) page.header.append(aside)
# RSS metadata # 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": if "feed" in meta and "pubdate" in meta and meta["pubdate"][0] != "draft":
pubdate = datetime.fromisoformat(meta["pubdate"][0]) pubdate = datetime.fromisoformat(meta["pubdate"][0])
link = f"https://www.alogoulogoi.com/{dest.relative_to(out).as_posix()}" link = f"https://www.alogoulogoi.com/{dest.relative_to(out).as_posix()}"