Fix archetype routing and narrow build sentinel dependencies

- Move Rmd archetype from _default/ to rmarkdown/ so hugo-new.sh's
  --kind rmarkdown resolves to the correct archetype instead of
  working by accident via file extension fallback
- Replace broad content/*/* glob in .build_sentinel with explicit
  find for content (.md, .html, images), layouts, and hugo.yaml
- Fix typo in Makefile comment ("my" -> "by")

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Andrew Stryker
2026-03-24 22:19:13 -07:00
parent 6848c6ca7e
commit 7280c9a623
3 changed files with 15 additions and 16 deletions

View File

@@ -100,11 +100,15 @@ LIBS_URL := /libs
#
#-----------------------------------------------------------------------------#
.build_sentinel: $(MD_TARGETS) $(wildcard content/*/*)
# Rebuild when rendered Rmd targets, markdown, or page bundle assets change
CONTENT_FILES := $(shell find content -name '*.md' -o -name '*.html' -o -name '*.svg' -o -name '*.png' -o -name '*.jpg' | grep -v '*~')
LAYOUT_FILES := $(shell find layouts -name '*.html' | grep -v '*~')
.build_sentinel: $(MD_TARGETS) $(CONTENT_FILES) $(LAYOUT_FILES) hugo.yaml
@echo "\t 🏗️ Building site"
@# We call hugo with two options:
@# --cleanDestinationDir, to remove deleted files
@# --minify, to compress files my removing extra whitespace
@# --minify, to compress files by removing extra whitespace
hugo --cleanDestinationDir --minify
@touch $@
@echo "✓ Building complete"

View File

@@ -18,11 +18,15 @@ fi
KIND="$1" # post or rmarkdown
TITLE="$2"
# Validate post type
if [[ "$KIND" != "post" && "$KIND" != "rmarkdown" ]]; then
echo "Error: Type must be 'post' or 'rmarkdown'."
exit 1
fi
# Validate post type and set file extension
case "$KIND" in
post) EXT="md" ;;
rmarkdown) EXT="Rmd" ;;
*)
echo "Error: Type must be 'post' or 'rmarkdown'."
exit 1
;;
esac
# Generate ISO date prefix (YYYY-MM-DD)
DATE=$(date +"%Y-%m-%d")
@@ -33,15 +37,6 @@ SLUG=$(echo "$TITLE" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
# Construct post directory
POST_DIR="content/posts/${DATE}-${SLUG}"
# Determine the expected file extension
EXT="md"
if [[ "$KIND" == "rmarkdown" ]]; then
EXT="Rmd"
fi
# Ensure the directory exists and create a page bundle
mkdir -p "$POST_DIR"
# Generate the new post with the selected archetype
hugo new --kind "$KIND" "posts/${DATE}-${SLUG}/index.${EXT}"
HUGO_EXIT_CODE=$?