diff options
author | EuAndreh <eu@euandre.org> | 2023-04-10 14:12:12 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-04-10 14:12:37 -0300 |
commit | fc794694b1d83d6856b36ea08df69c2a0861d030 (patch) | |
tree | 752cb386042281cfcc72836623af733c3253bff2 /v2/src/bin/index | |
parent | v2: Support translated alternates in <nav> (diff) | |
download | euandre.org-fc794694b1d83d6856b36ea08df69c2a0861d030.tar.gz euandre.org-fc794694b1d83d6856b36ea08df69c2a0861d030.tar.xz |
v2: <link /> to translated version in <head />
Diffstat (limited to 'v2/src/bin/index')
-rwxr-xr-x | v2/src/bin/index | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/v2/src/bin/index b/v2/src/bin/index index 553cc27..36abd2e 100755 --- a/v2/src/bin/index +++ b/v2/src/bin/index @@ -85,7 +85,15 @@ 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 +translations_head_html="$(langs | + awk -v lang="${lang:?}" -v coll="$collection" '$0 != lang { + "coll2path " $0 " " coll | getline coll_path + "url-for " $0 "/" coll_path | getline url + printf " <link rel=\"alternate\" type=\"text/html\" href=\"%s\" hreflang=\"%s\" />\n", + url, $0 + }' +)" +translations_body_html="$(cat <<-EOF <ul class="translation-list"> $(langs | awk -v coll="$collection" '{ "coll2path " $0 " " coll | getline coll_path @@ -95,7 +103,7 @@ translations_html="$(cat <<-EOF </ul> EOF )" -export translations_html +export translations_head_html translations_body_html |