aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-04-05 16:54:59 -0300
committerEuAndreh <eu@euandre.org>2023-04-05 16:54:59 -0300
commit2253577076620e423a72944dc4ce46225bd22b7d (patch)
treee6471b3daeb3f1600a241c205af9c96b0b59d9e0
parentv2: src/bin/conf: Use shesc(1) from $PATH (diff)
downloadeuandre.org-2253577076620e423a72944dc4ce46225bd22b7d.tar.gz
euandre.org-2253577076620e423a72944dc4ce46225bd22b7d.tar.xz
v2: src/bin/conf: Include "$layout" and "$collection" variables
-rwxr-xr-xv2/src/bin/conf21
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"