aboutsummaryrefslogtreecommitdiff
path: root/v2/src/bin/index
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-09 18:59:09 -0300
committerEuAndreh <eu@euandre.org>2023-04-09 19:05:39 -0300
commit19a8b995c59cce5315e1d121054f9c27aad5c960 (patch)
treef2c2d83751245004beed21b31d973c1d412cd026 /v2/src/bin/index
parentv2: CSS dark mode, including SVGs (diff)
downloadeuandre.org-19a8b995c59cce5315e1d121054f9c27aad5c960.tar.gz
euandre.org-19a8b995c59cce5315e1d121054f9c27aad5c960.tar.xz
v2: Support translated alternates in <nav>
Diffstat (limited to 'v2/src/bin/index')
-rwxr-xr-xv2/src/bin/index15
1 files changed, 13 insertions, 2 deletions
diff --git a/v2/src/bin/index b/v2/src/bin/index
index 46e0c88..553cc27 100755
--- a/v2/src/bin/index
+++ b/v2/src/bin/index
@@ -75,8 +75,7 @@ l="$(lang-for "$FILENAME")"
# shellcheck source=/dev/null
. src/lib/base."$l".conf
-url_part="$(printf '%s' "${FILENAME#"$CONTENT_PREFIX"/}" | sed "s|\.md$|.html|")"
-url_absolute="$(url-for "$url_part" | absolute)"
+url_absolute="$(url-for "$FILENAME" | absolute)"
collection="$(collection-for "$FILENAME")"
feed_url="$(url-for "${DIR#"$CONTENT_PREFIX"/}"/feed.xml)"
by_category_url="$(url-for "${DIR#"$CONTENT_PREFIX"/}/${by_category_url_name:?}")"
@@ -86,6 +85,18 @@ index_category_title_html="$(eval "echo \"\$index_category_${collection}_title\"
export url_absolute feed_url by_category_url title_html index_recent_title_html \
index_category_title_html
+translations_html="$(cat <<-EOF
+ <ul class="translation-list">
+ $(langs | awk -v coll="$collection" '{
+ "coll2path " $0 " " coll | getline coll_path
+ "url-for " $0 "/" coll_path | getline url
+ printf " <li><a href=\"%s\">%s</a></li>\n", url, $0
+ }')
+ </ul>
+EOF
+)"
+export translations_html
+
mkdir -p "$DIR"