website/site/helpers.awk

33 lines
706 B
Awk
Raw Normal View History

2022-12-27 22:04:45 +01:00
{ helpers = "yes" }
function load_helpers() {
data["page_title"] = page_title()
data["section_blog"] = section_blog()
data["section_code"] = section_code()
data["section_photos"] = section_photos()
}
function page_title( title) {
if (data["title"]) {
title = data["title"] " - " data["site_title"]
} else {
title = data["site_title"]
}
return title
}
function section_blog(section) {
if (data["section"] == "blog") {
return " class=\"section\""
}
}
function section_code(section) {
if (data["section"] == "code") {
return " class=\"section\""
}
}
function section_photos(section) {
if (data["section"] == "photos") {
return " class=\"section\""
}
}