From fa44f4eb7d77be7d75d00ded21022024aab160f4 Mon Sep 17 00:00:00 2001 From: "Felipe M." Date: Thu, 3 Apr 2025 19:10:41 +0200 Subject: [PATCH] feat: Add `new-post` Makefile target to generate blog posts --- Makefile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ec5ee40..b788a75 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,19 @@ -.PHONY: server +.PHONY: server new-post server: hugo server + +new-post: + @YEAR=$$(date +%Y); \ + MONTH=$$(date +%m); \ + DAY=$$(date +%d); \ + POST_DIR="content/blog/$$YEAR/$$MONTH/$$DAY/dummy"; \ + mkdir -p "$$POST_DIR"; \ + echo "+++" > "$$POST_DIR/index.md"; \ + echo "title = Dummy Post" >> "$$POST_DIR/index.md"; \ + echo "date = $$(date +%Y-%m-%d)" >> "$$POST_DIR/index.md"; \ + echo "draft = false" >> "$$POST_DIR/index.md"; \ + echo "+++" >> "$$POST_DIR/index.md"; \ + echo "" >> "$$POST_DIR/index.md"; \ + echo "Content goes here" >> "$$POST_DIR/index.md"; \ + echo "Created new post at $$POST_DIR/index.md"