frontmatter meta stuff

This commit is contained in:
41666 2025-04-21 19:24:16 -07:00
parent 9aad36f910
commit c2861b8f18
7 changed files with 204 additions and 18 deletions

View file

@ -35,7 +35,7 @@ in pkgs.stdenvNoCC.mkDerivation {
key=$1
file=$2
keyLine=$(grep -e "$key: " $file || echo "")
keyLine=$(grep -e "^$key: " $file || echo "")
sed "s/.*: //" <<<$keyLine | xargs
}
@ -66,9 +66,25 @@ in pkgs.stdenvNoCC.mkDerivation {
title=$(basename $file | sed -e 's/.doll$//')
fi
### Frontmatter: Meta Head Stuff
local head=""
local meta_description=$(get_frontmatter description $file)
if [ ! -z meta_description ]; then
head="$head<meta name='description' content='$meta_description'>"
fi
local meta_tags=$(get_frontmatter tags $file)
if [ ! -z meta_tags ]; then
head="$head<meta name='keywords' content='$meta_tags'>"
fi
local meta_author=$(get_frontmatter author $file)
if [ ! -z meta_author ]; then
head="$head<meta name='author' content='$meta_author'>"
fi
### Layout: Title + Content
layout_inject $layoutPath %%TITLE%% <<<"$title" > $outFile.tmp.1
layout_inject $outFile.tmp.1 %%CONTENT%% $content > $outFile.tmp.final
layout_inject $outFile.tmp.1 %%HEAD%% <<<"$head" > $outFile.tmp.2
layout_inject $outFile.tmp.2 %%CONTENT%% $content > $outFile.tmp.final
### Layout: Cleanup Tmpfiles
cp $outFile.tmp.final $outFile