aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStonewall Jackson <stonewall@sacredheartsc.com>2023-06-25 09:37:53 -0400
committerStonewall Jackson <stonewall@sacredheartsc.com>2023-06-25 09:37:53 -0400
commit2fb089aff9acb935bff37bb8a9d4060b3975d969 (patch)
treed63a19475b5f482d7ed66845965b57f6794e31bb
parent145ef95236bb375fa5b668ea9ef122b0b4d1f9ea (diff)
downloadwww-2fb089aff9acb935bff37bb8a9d4060b3975d969.tar.gz
www-2fb089aff9acb935bff37bb8a9d4060b3975d969.zip
add makefile target for new posts
-rw-r--r--Makefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 8f81f2b..5979f57 100644
--- a/Makefile
+++ b/Makefile
@@ -96,6 +96,15 @@ $(OUTPUT_DIR)/%: $(SOURCE_DIR)/%
install:
pip install -r requirements.txt
+.PHONY: post
+post:
+ @test $${NAME?Post URL component must be set in variable NAME.}
+ifeq (,$(wildcard $(SOURCE_DIR)/$(BLOG_DIR)/$(NAME)/index.md))
+ mkdir -p "$(SOURCE_DIR)/$(BLOG_DIR)/$(NAME)"
+ printf -- '---\ntitle: %s\ndate: %s\nsubtitle:\ndescription: \n---\n\n\n' "$(NAME)" "$$(date '+%B %d, %Y')" > $(SOURCE_DIR)/$(BLOG_DIR)/$(NAME)/index.md
+endif
+ $(EDITOR) $(SOURCE_DIR)/$(BLOG_DIR)/$(NAME)/index.md
+
serve: public
cd $(OUTPUT_DIR) && python3 -m http.server