diff options
author | EuAndreh <eu@euandre.org> | 2023-04-10 16:18:01 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-04-10 16:18:01 -0300 |
commit | 4b9cddca7f0f75e321319c79e94b3af3ce37e5ef (patch) | |
tree | 3cbbaba20deadebb9169c6c2a1ea65d984da05ae /v2/src/bin/conf | |
parent | v2: <link /> to translated version in <head /> (diff) | |
download | euandre.org-4b9cddca7f0f75e321319c79e94b3af3ce37e5ef.tar.gz euandre.org-4b9cddca7f0f75e321319c79e94b3af3ce37e5ef.tar.xz |
v2: <link /> to collection feed inside <head>
Diffstat (limited to '')
-rwxr-xr-x | v2/src/bin/conf | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/v2/src/bin/conf b/v2/src/bin/conf index 3b56dbd..9fb4664 100755 --- a/v2/src/bin/conf +++ b/v2/src/bin/conf @@ -118,10 +118,32 @@ done < "$FILENAME" | tee -a "$FILENAME".tmp rm -f "$FILENAME".tmp +lang="$(lang-for "$FILENAME")" +export lang +printf 'export lang="%s"\n' "$lang" + +cat src/lib/base."${lang:?}".conf +# shellcheck source=/dev/null +. src/lib/base."$lang".conf +if [ -z "${title:-}" ]; then + title="${site_name:?}" + printf 'export title="%s"\n' "$(printf '%s' "$title" | shesc)" +fi + + collection="$(collection-for "$FILENAME" ||:)" if [ -n "$collection" ]; then export collection printf 'export collection="%s"\n' "$collection" + + coll_path="$(coll2path "$lang" "$collection")" + feed_title="$(eval "echo \"\$feed_${collection}_title\"" | htmlesc)" + + collection_head_html="$(printf ' <link rel="alternate" type="application/atom+xml" href="%s" title="%s" />' \ + "$(url-for "$lang/$coll_path")" \ + "$(htmlesc "$feed_title")" + )" + printf 'export collection_head_html="%s"\n' "$(shesc "$collection_head_html")" fi if [ -z "${layout:-}" ]; then @@ -142,21 +164,9 @@ if [ -z "${layout:-}" ]; then fi -lang="$(lang-for "$FILENAME")" -export lang -printf 'export lang="%s"\n' "$lang" - -cat src/lib/base."${lang:?}".conf -# shellcheck source=/dev/null -. src/lib/base."$lang".conf -if [ -z "${title:-}" ]; then - title="${site_name:?}" - printf 'export title="%s"\n' "$(printf '%s' "$title" | shesc)" -fi - if [ -r "$FILENAME".i18n ]; then translations_head="$(awk -F: -v lang="$lang" '$1 != lang{ - printf " <link rel=\"alternate\" type=\"text/html\" href=\"%s\" hreflang=\"%s\" />\n", + printf " <link rel=\"alternate\" type=\"text/html\" href=\"%s\" hreflang=\"%s\" />\n", $3, $1 }' "$FILENAME".i18n)" translations_body="$(cat <<-EOF |