Summary Files Commits Branches @commit @diff @stats
path: root / ext / meta.awk
diff options
context:
space:
mode:
1 files changed, 22 insertions, 0 deletions
-rw-r--r--ext/meta.awk22
diff --git a/ext/meta.awk b/ext/meta.awk
new file mode 100644
index 0000000..1815cdf
--- /dev/null
+++ b/ext/meta.awk
@@ -0,0 +1,22 @@
+BEGIN {
+ FS="\t"
+ while ((getline < ENVIRON["META"]) > 0) {
+ if ($1 == "") continue
+ meta_title[$1] = $2 " &mdash; Syndamia"
+ meta_description[$1] = $3
+ }
+ FS=" "
+}
+
+FNR == 0 {
+ STD_FILENAME = substr(FILENAME, length(ENVIRON["GEN_DIR"]) + 2)
+
+ if (STD_FILENAME in meta_title) {
+ substitutions["TITLE"] = meta_title[STD_FILENAME]
+ substitutions["DESCRIPTION"] = meta_description[STD_FILENAME]
+ }
+ else {
+ delete substitutions["TITLE"]
+ delete substitutions["DESCRIPTION"]
+ }
+}