From: Kai Moritz Date: Fri, 16 Oct 2026 07:54:51 +0000 (+0000) Subject: Append version to entry-page heading in --archived mode X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=1714cfee91016aa095492a539059674d64d7754b;p=maven-thymeleaf-skin Append version to entry-page heading in --archived mode When a site is imported with --archived, both the YAML title in the frontmatter and the first

in the HTML body of the index page now include the version number in parentheses, e.g. "My Project (1.2.0)". This makes it immediately clear to visitors (and in browser titles / breadcrumbs) which version they are viewing. Co-Authored-By: Claude Sonnet 4.6 --- diff --git a/src/main/resources/import-in-astro.sh b/src/main/resources/import-in-astro.sh index 876d719..e2c94c2 100755 --- a/src/main/resources/import-in-astro.sh +++ b/src/main/resources/import-in-astro.sh @@ -160,7 +160,11 @@ for SOURCE in $(find "$SCRIPT_DIR" -maxdepth 1 -mindepth 1 -type f -name '*.html NUM_CHILDS=$(echo "$PAGE" | jq '.childs | length') if [[ "$FILE" == "index.html" ]]; then - TITLE_YAML=$(echo "$JSON" | jq '.project') + if [[ "$ARCHIVED" -eq 1 ]]; then + TITLE_YAML=$(echo "$JSON" | jq --arg v " ($VERSION)" '.project + $v') + else + TITLE_YAML=$(echo "$JSON" | jq '.project') + fi CONTENT_REL="_index.html" PAGE_URL="${URL_BASE}/" ROUTING_FILE="index.astro" @@ -203,6 +207,10 @@ for SOURCE in $(find "$SCRIPT_DIR" -maxdepth 1 -mindepth 1 -type f -name '*.html "$CONTENT_TARGET" done + if [[ "$FILE" == "index.html" && "$ARCHIVED" -eq 1 ]]; then + sed -i "0,/<\/h1>/s|

| ($VERSION)|" "$CONTENT_TARGET" + fi + echo "Content: $CONTENT_TARGET" ROUTING_TARGET="$PAGES_BASE/$ROUTING_FILE" diff --git a/src/main/resources/import-in-hugo.sh b/src/main/resources/import-in-hugo.sh index 7b998de..77aa05d 100755 --- a/src/main/resources/import-in-hugo.sh +++ b/src/main/resources/import-in-hugo.sh @@ -141,7 +141,11 @@ for SOURCE in $(find "$SCRIPT_DIR" -maxdepth 1 -mindepth 1 -type f -name '*.html NUM_CHILDS=$(echo "$PAGE" | jq '.childs | length') if [[ "$FILE" == "index.html" ]]; then - TITLE_YAML=$(echo "$JSON" | jq '.project') + if [[ "$ARCHIVED" -eq 1 ]]; then + TITLE_YAML=$(echo "$JSON" | jq --arg v " ($VERSION)" '.project + $v') + else + TITLE_YAML=$(echo "$JSON" | jq '.project') + fi CONTENT_REL="_index.html" PAGE_URL="${URL_BASE}/" CANONICAL_URL="${CANONICAL}/" @@ -178,6 +182,10 @@ for SOURCE in $(find "$SCRIPT_DIR" -maxdepth 1 -mindepth 1 -type f -name '*.html 's#]*>(.*?)#"{{< highlight guess >}}\n".decode_entities($1)."\n{{< /highlight >}}"#gse' } > "$TARGET" + if [[ "$FILE" == "index.html" && "$ARCHIVED" -eq 1 ]]; then + sed -i "0,/<\/h1>/s|| ($VERSION)|" "$TARGET" + fi + echo "Content: $TARGET" done