Compare commits
No commits in common. "1a7c02ca64a6cd74d02030a037a25c6ec932dea5" and "9355856dc4b99533ab0e0bfc4b9be61dd20d50ac" have entirely different histories.
1a7c02ca64
...
9355856dc4
17
Makefile
17
Makefile
|
@ -1,26 +1,23 @@
|
|||
.PHONY: *
|
||||
|
||||
help: ## display this help
|
||||
@awk 'BEGIN{FS = ":.*##"; printf "\033[1m\nUsage\n \033[1;92m make\033[0;36m <target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST)
|
||||
|
||||
build: ## compile src/ into out/ with pagefind
|
||||
./build.py out/
|
||||
build:
|
||||
./build.py out/ --draft
|
||||
pagefind --site out/
|
||||
|
||||
clean: ## delete out/ and src/
|
||||
clean:
|
||||
test -e out && rm -rf out || true
|
||||
test -e srv && rm -rf srv || true
|
||||
|
||||
watch: ## rebuild on changes
|
||||
watch:
|
||||
while inotifywait -r -e modify -e move -e create -e delete build.py Makefile src/; do make build; done
|
||||
|
||||
serve: ## serve out/
|
||||
serve:
|
||||
python -m http.server --directory out/
|
||||
|
||||
pubdate: ## Replace "pubdate: now" with the current date
|
||||
pubdate:
|
||||
sed -i "s/pubdate: now/pubdate: $$(date -Isec)/" src/blog/**/*.md
|
||||
|
||||
upload: ## build to srv/ and upload to www.alogoulogoi.com
|
||||
upload:
|
||||
test -e srv && rm -rf srv || true
|
||||
./build.py srv/
|
||||
pagefind --site srv/
|
||||
|
|
19
build.py
19
build.py
|
@ -6,26 +6,16 @@ import copy
|
|||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
import bs4
|
||||
from feedgen.feed import FeedGenerator
|
||||
import markdown
|
||||
|
||||
|
||||
def get_pubdate(src_path):
|
||||
pubdate = subprocess.run(
|
||||
["git", "log", "--diff-filter=A", "--format=%aI", "--", src_path],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=True,
|
||||
)
|
||||
return datetime.fromisoformat(pubdate.stdout.strip())
|
||||
|
||||
|
||||
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")
|
||||
|
@ -134,8 +124,11 @@ def main():
|
|||
page.header.append(aside)
|
||||
|
||||
# RSS metadata
|
||||
if "feed" in meta:
|
||||
pubdate = get_pubdate(path.as_posix())
|
||||
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()}"
|
||||
for feed in meta["feed"]:
|
||||
if feed not in feeds:
|
||||
|
|
|
@ -23,7 +23,12 @@
|
|||
pkgs.pagefind
|
||||
];
|
||||
shellHook = ''
|
||||
make help
|
||||
echo "make build - compile src/ into out/ with pagefind"
|
||||
echo "make clean - delete out/ and srv/"
|
||||
echo "make watch - rebuild on changes"
|
||||
echo "make serve - serve out/"
|
||||
echo "make pubdate - replace 'now' with the current date"
|
||||
echo "make upload - build to srv/ and upload to alogoulogoi"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: The traditional first software engineer blog post
|
||||
pubdate: 2023-09-28T15:39:59-07:00
|
||||
feed: blog
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: SHLVL PS1
|
||||
pubdate: 2023-12-18T09:53:17-08:00
|
||||
feed: blog
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: Backing up my ZFS NAS to an external drive
|
||||
pubdate: 2023-09-29T16:23:49-07:00
|
||||
feed: blog
|
||||
---
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
title: Archiving bookmarks
|
||||
pubdate: 2024-05-27T21:06:37-07:00
|
||||
feed: blog
|
||||
---
|
||||
|
||||
|
|
Loading…
Reference in New Issue