## Custom Variablen einlesen
#set ( $menuName = $site.custom.getChild( 'menuName' ).getValue() )
#set ( $debug = $site.custom.getChild( 'debug' ).getValue() )
+#set ( $published = $site.custom.getChild( 'published' ).getValue() )
+#set ( $weight = $site.custom.getChild( 'weight' ).getValue() )
## Die Root der Seiten-Hierarchie wird explizit erzeugt
#if ($debug)
<!-- PREPARING ROOT-ENTRY - name: $project.name ref: index.html -->
"version": "$project.version",
"generator": "Apache Maven Doxia Site Renderer $!{doxiaSiteRendererVersion}",
"generated": "$date.get("yyyy-MM-dd'T'HH:mm:ss'Z'")",
+#if ( $published )
+ "published": "$published",
+#end
+#if ( $weight )
+ "weight": $weight,
+#end
"pages": [#set( $page_sep="")#foreach( $page in $pages )$page_sep
{
#if ( $page.name )
set -euo pipefail
USAGE=$(
- echo "Usage: $0 <ASTRO_ROOT> [--base <path>] [--project <name>] [ [--current [<url>]] | [--archived [<url>] [--canonical <url>]] ]";
+ echo "Usage: $0 <ASTRO_ROOT> [--base <path>] [--project <name>] [--published <date>] [ [--current [<url>]] | [--archived [<url>] [--canonical <url>]] ]";
cat << EOF
Imports a Maven site generated with the StILi skin into an Astro project.
is appended as well.
--project : Overrides the project name used for URL and directory paths
(Default: artifactId from the Maven project metadata).
+--published : Sets the published date (YYYY-MM-DD) written to the root page frontmatter.
+ Overrides <published> from src/site/site.xml.
+ Default: today's date.
--current : [DEFAULT]
Marks this version as the current (visible) release.
Content URL: <base>/<project>/page.html, params.current=true
BASE=""
PROJECT=""
+PUBLISHED=""
CURRENT=0
ARCHIVED=0
URL_BASE=""
if [[ $# -lt 2 ]]; then echo "ERROR -- Parameter for --project is missing!"; exit 1; fi
PROJECT="${2%%/}"; PROJECT="${PROJECT##/}"; shift 2
;;
+ --published)
+ if [[ $# -lt 2 ]]; then echo "ERROR -- Parameter for --published is missing!"; exit 1; fi
+ if [[ ! "$2" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
+ echo "ERROR -- --published requires a date in YYYY-MM-DD format"; exit 1
+ fi
+ PUBLISHED="$2"; shift 2
+ ;;
--current)
CURRENT=1
if [[ $# -ge 2 && ! "$2" =~ ^-- ]]; then
[[ -z "$PROJECT" ]] && PROJECT=$(echo "$JSON" | jq -r '.artifactId')
VERSION=$(echo "$JSON" | jq -r '.version')
+JSON_PUBLISHED=$(echo "$JSON" | jq -r '.published // empty')
+JSON_WEIGHT=$(echo "$JSON" | jq -r '.weight // empty')
+[[ -z "$PUBLISHED" && -n "$JSON_PUBLISHED" ]] && PUBLISHED="$JSON_PUBLISHED"
+[[ -z "$PUBLISHED" ]] && PUBLISHED=$(date +%Y-%m-%d)
+
if [[ -n "$URL_BASE" ]]; then
URL_BASE="${URL_BASE%/}"
elif [[ "$CURRENT_BOOL" == "true" ]]; then
echo "Current: $CURRENT_BOOL"
echo "URL base: $URL_BASE"
[[ "$CURRENT_BOOL" == "false" ]] && echo "Canonical: $CANONICAL"
+echo "Published: $PUBLISHED"
+[[ -n "$JSON_WEIGHT" ]] && echo "Weight: $JSON_WEIGHT"
echo ""
# Known generated-doc dirs (must match GENERATED_DOC_NAMES in src/lib/projects.ts)
TITLE_YAML=$(echo "$JSON" | jq '.project')
fi
DESCRIPTION_YAML=$(echo "$JSON" | jq '.description // empty')
+ PUBLISHED_YAML="$PUBLISHED"
+ [[ -n "$JSON_WEIGHT" ]] && WEIGHT="$JSON_WEIGHT"
CONTENT_REL="_index.html"
PAGE_URL="${URL_BASE}/"
ROUTING_FILE="index.astro"
else
TITLE_YAML=$(echo "$PAGE" | jq '.name')
DESCRIPTION_YAML=""
+ PUBLISHED_YAML=""
HREF="$FILE"
if [[ "$NUM_CHILDS" -gt 0 ]]; then
CONTENT_REL="${PATH_PREFIX}${HREF%.html}/_index.html"
echo "weight: $WEIGHT"
echo "url: $PAGE_URL"
[[ -n "$DESCRIPTION_YAML" ]] && echo "description: $DESCRIPTION_YAML"
+ [[ -n "$PUBLISHED_YAML" ]] && echo "published: $PUBLISHED_YAML"
echo "params:"
echo " current: $CURRENT_BOOL"
[[ "$CURRENT_BOOL" == "false" ]] && echo " canonical: $CANONICAL_URL"
set -euo pipefail
USAGE=$(
- echo "Usage: $0 <HUGO_ROOT> [--base <path>] [--project <name>] [ [--current [<url>]] | [--archived [<url>] [--canonical <url>]] ]";
+ echo "Usage: $0 <HUGO_ROOT> [--base <path>] [--project <name>] [--published <date>] [ [--current [<url>]] | [--archived [<url>] [--canonical <url>]] ]";
cat << EOF
Imports a Maven site generated with the StILi skin into a Hugo project.
The project name and version are always appended.
--project : Overrides the project name used for URL and directory paths
(Default: artifactId from the Maven project metadata).
+--published : Sets the published date (YYYY-MM-DD) written to the root page frontmatter.
+ Overrides <published> from src/site/site.xml.
+ Default: today's date.
--current : [DEFAULT]
Marks this version as the current (visible) release.
Content URL: <base>/<project>/page.html, params.current=true
BASE=""
PROJECT=""
+PUBLISHED=""
CURRENT=0
ARCHIVED=0
URL_BASE=""
if [[ $# -lt 2 ]]; then echo "ERROR -- Parameter for --project is missing!"; exit 1; fi
PROJECT="${2%%/}"; PROJECT="${PROJECT##/}"; shift 2
;;
+ --published)
+ if [[ $# -lt 2 ]]; then echo "ERROR -- Parameter for --published is missing!"; exit 1; fi
+ if [[ ! "$2" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
+ echo "ERROR -- --published requires a date in YYYY-MM-DD format"; exit 1
+ fi
+ PUBLISHED="$2"; shift 2
+ ;;
--current)
CURRENT=1
if [[ $# -ge 2 && ! "$2" =~ ^-- ]]; then
[[ -z "$PROJECT" ]] && PROJECT=$(echo "$JSON" | jq -r '.artifactId')
VERSION=$(echo "$JSON" | jq -r '.version')
+JSON_PUBLISHED=$(echo "$JSON" | jq -r '.published // empty')
+JSON_WEIGHT=$(echo "$JSON" | jq -r '.weight // empty')
+[[ -z "$PUBLISHED" && -n "$JSON_PUBLISHED" ]] && PUBLISHED="$JSON_PUBLISHED"
+[[ -z "$PUBLISHED" ]] && PUBLISHED=$(date +%Y-%m-%d)
+
PATH_BASE="$BASE/$PROJECT/$VERSION"
if [[ -n "$URL_BASE" ]]; then
echo "Current: $CURRENT_BOOL"
echo "URL base: $URL_BASE"
[[ "$CURRENT_BOOL" == "false" ]] && echo "Canonical: $CANONICAL"
+echo "Published: $PUBLISHED"
+[[ -n "$JSON_WEIGHT" ]] && echo "Weight: $JSON_WEIGHT"
echo ""
for SOURCE in $(find "$SCRIPT_DIR" -maxdepth 1 -mindepth 1 -type f -name '*.html'); do
else
TITLE_YAML=$(echo "$JSON" | jq '.project')
fi
+ PUBLISHED_YAML="$PUBLISHED"
+ [[ -n "$JSON_WEIGHT" ]] && WEIGHT="$JSON_WEIGHT"
CONTENT_REL="_index.html"
PAGE_URL="${URL_BASE}/"
CANONICAL_URL="${CANONICAL}/"
else
+ PUBLISHED_YAML=""
TITLE_YAML=$(echo "$PAGE" | jq '.name')
HREF="$FILE"
if [[ "$NUM_CHILDS" -gt 0 ]]; then
echo "---"
echo "title: $TITLE_YAML"
echo "weight: $WEIGHT"
+ [[ -n "$PUBLISHED_YAML" ]] && echo "published: $PUBLISHED_YAML"
echo "outputs:"
echo " - html"
echo "url: $PAGE_URL"