Summary Files Commits Branches @commit @diff @stats
path: root / generate-hooks / create-title.awk
diff options
context:
space:
mode:
Commit0187e255a811bebb0dad3624f2c6d78b829d15c5 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-01-17 16:15:28 +0200
Files68efd3520e72c8c8c553fdda7b9391d9ec4e9feb /generate-hooks/create-title.awk
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.tar.gz
syndamia.com-0187e255a811bebb0dad3624f2c6d78b829d15c5.zip
Parentda000c477625bb533688df84bd95ba3a3aff3246 (diff)
[awk] Reworked generation to happen via a combined script, updated scripts and added info in scripts readme
1 files changed, 0 insertions, 30 deletions
-rw-r--r--generate-hooks/create-title.awk30
diff --git a/generate-hooks/create-title.awk b/generate-hooks/create-title.awk
deleted file mode 100644
index 24d5f7d..0000000
--- a/generate-hooks/create-title.awk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# == 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, "<h1")
- close(ARGV[1]) # FILENAME isn't set during BEGIN
-
- # Removes the opening tag and substrings everything that is normally
- # inside the heading tag
- gsub(/<h1[^>]*>/, "")
- title = substr($0, h1Index, index($0, "</h1") - h1Index)
-}
-
-"\\[TITLE\\]" {
- gsub("\\[TITLE\\]", title)
-}
-
-{
- print
-}