From 2253577076620e423a72944dc4ce46225bd22b7d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 5 Apr 2023 16:54:59 -0300 Subject: v2: src/bin/conf: Include "$layout" and "$collection" variables --- v2/src/bin/conf | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'v2') 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" -- cgit v1.2.3