diff options
author | EuAndreh <eu@euandre.org> | 2023-04-05 16:54:59 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2023-04-05 16:54:59 -0300 |
commit | 2253577076620e423a72944dc4ce46225bd22b7d (patch) | |
tree | e6471b3daeb3f1600a241c205af9c96b0b59d9e0 /v2 | |
parent | v2: src/bin/conf: Use shesc(1) from $PATH (diff) | |
download | euandre.org-2253577076620e423a72944dc4ce46225bd22b7d.tar.gz euandre.org-2253577076620e423a72944dc4ce46225bd22b7d.tar.xz |
v2: src/bin/conf: Include "$layout" and "$collection" variables
Diffstat (limited to '')
-rwxr-xr-x | v2/src/bin/conf | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/v2/src/bin/conf b/v2/src/bin/conf index 8345591..5717039 100755 --- a/v2/src/bin/conf +++ b/v2/src/bin/conf @@ -92,6 +92,27 @@ done < "$FILENAME" | tee -a "$FILENAME".tmp rm -f "$FILENAME".tmp +if [ -z "${layout:-}" ]; then + if [ "$(dirname "$(dirname "$FILENAME")")" = "$CONTENT_PREFIX" ]; then + layout=page + else + layout=post + collection="$(basename "$(dirname "$FILENAME")")" + export collection + printf 'export collection="%s"\n' "$collection" + + custom_layout="$(echo "$LAYOUTS" | grep . | + awk -v coll="$collection" '$1 == coll { print $2 }' + )" + if [ -n "$custom_layout" ]; then + layout="$custom_layout" + fi + fi + export layout + printf 'export layout="%s"\n' "$layout" +fi + + lang="$(lang-for "$FILENAME")" export lang printf 'export lang="%s"\n' "$lang" |