summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf12
-rwxr-xr-xsrc/mapentry19
-rwxr-xr-xsrc/sitemap22
3 files changed, 53 insertions, 0 deletions
diff --git a/src/conf b/src/conf
index 16c43a8..6951462 100755
--- a/src/conf
+++ b/src/conf
@@ -168,6 +168,9 @@ cat -- "$CONF"
url="$(printf '%s\n' "${UNPREFIXED%.adoc}.html" | shesc)"
+
+lastmod_epoch="$(stat --printf='%Y' "$FILENAME" | shesc)"
+
collurl=
date_iso=
date_epoch=
@@ -180,15 +183,21 @@ if is_article; then
date_iso="$(dateiso "$lastdirnames" | shesc)"
date_epoch="$(dateepoch "$date_iso" | shesc)"
date_formatted="$(datefmt "$date_iso" | shesc)"
+ lastmod_epoch="$date_epoch"
if [ -n "${updatedat:-}" ]; then
updatedat_iso="$(dateiso "$updatedat" | shesc)"
updatedat_epoch="$(dateepoch "$updatedat_iso" | shesc)"
updatedat_formatted="$(datefmt "$updatedat_iso" | shesc)"
+ lastmod_epoch="$updatedat_epoch"
fi
file="$(basename "$url")"
collurl="$(printf '%s\n' "$lastdirnames" | sed 's|-|/|g' | shesc)/$file"
fi
+lastmod_iso="$(dateiso "@$lastmod_epoch" | shesc)"
+lastmod_formatted="$(datefmt "$lastmod_iso" | shesc)"
+
+
BASE_URL="$(base_url)"
TITLE_RAW="$(cat -- "$FILENAME" | grep '^= .*' | head -n1 | cut -d' ' -f2- ||
echo 'MISSING')"
@@ -257,6 +266,9 @@ cat <<-EOF
export title_html="$title_html"
export titlefull="$titlefull"
export titlefull_html="$titlefull_html"
+ export lastmod_iso="$lastmod_iso"
+ export lastmod_epoch="$lastmod_epoch"
+ export lastmod_formatted="$lastmod_formatted"
export date_iso="$date_iso"
export date_epoch="$date_epoch"
export date_formatted="$date_formatted"
diff --git a/src/mapentry b/src/mapentry
new file mode 100755
index 0000000..857d4bd
--- /dev/null
+++ b/src/mapentry
@@ -0,0 +1,19 @@
+#!/bin/sh
+set -euo pipefail
+
+
+usage() {
+ echo 'Usage: mapentry FILENAME.conf'
+}
+
+FILENAME="${1:-}"
+eval "$(assert-arg -- "$FILENAME" 'FILENAME.conf')"
+. ./"$FILENAME"
+
+
+cat <<EOF
+ <url>
+ <loc>$url_absolute</loc>
+ <lastmod>$lastmod_iso</lastmod>
+ </url>
+EOF
diff --git a/src/sitemap b/src/sitemap
new file mode 100755
index 0000000..48be5ea
--- /dev/null
+++ b/src/sitemap
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -euo pipefail
+
+
+opening() {
+ cat <<'EOF'
+<?xml version="1.0" encoding="UTF-8"?>
+<urlset
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
+ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+EOF
+}
+
+closing() {
+ echo '</urlset>'
+}
+
+
+opening
+cat "$@"
+closing