From 0187e255a811bebb0dad3624f2c6d78b829d15c5 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 17 Jan 2023 16:15:28 +0200 Subject: [awk] Reworked generation to happen via a combined script, updated scripts and added info in scripts readme --- awk-edits/Header-Title.awk | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 awk-edits/Header-Title.awk (limited to 'awk-edits/Header-Title.awk') diff --git a/awk-edits/Header-Title.awk b/awk-edits/Header-Title.awk new file mode 100644 index 0000000..16247e8 --- /dev/null +++ b/awk-edits/Header-Title.awk @@ -0,0 +1,26 @@ +# +# == About == +# +# Every page has a og:title meta tag, which has to be generated from the page +# itself. The title tag is automatically filled in by ssg. +# The value for the meta tag is "[TITLE]" and it gets replaced with all text +# inside first h1 header tag. + +BEGIN { + h1Index = 0 + + # When this loop finishes, $0 will have the first line containing an h1 header + # tag, and h1Index will have it's starting position + while (h1Index == 0 && getline < ARGV[1]) + h1Index = index($0, "]*>/, "") + title = substr($0, h1Index, index($0, "