From 2fb089aff9acb935bff37bb8a9d4060b3975d969 Mon Sep 17 00:00:00 2001 From: Stonewall Jackson Date: Sun, 25 Jun 2023 09:37:53 -0400 Subject: add makefile target for new posts --- Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Makefile') 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 -- cgit