From 84566a32b1b0cf4fa57bb9d5409ee794deceab7f Mon Sep 17 00:00:00 2001 From: Volpeon Date: Sun, 14 Nov 2021 12:46:40 +0100 Subject: Added redirect fallback template --- scripts/metadata_filter.lua | 3 ++- templates/base.html | 5 +++++ templates/layouts/redirect.html | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 templates/layouts/redirect.html diff --git a/scripts/metadata_filter.lua b/scripts/metadata_filter.lua index 0ff7429..c7f4d4a 100644 --- a/scripts/metadata_filter.lua +++ b/scripts/metadata_filter.lua @@ -259,6 +259,7 @@ end function process(global, parent, meta) meta.namespace = resolve_namespace(meta.namespace) meta.file_out = pandoc.utils.stringify(meta.file_out):gsub("^out", "") + meta.redirect = meta.url and true meta.url = meta.url and pandoc.utils.stringify(meta.url) meta.url = resolve_url(global.site.url, global.file_out, meta.url or meta.file_out) meta.title = (meta.title and pandoc.utils.stringify(meta.title)) or "" @@ -292,7 +293,7 @@ function process(global, parent, meta) meta.pages = process_pages(global, { parent = parent, meta = meta }, meta.list_order, meta.pages) meta.depth = (meta.pages and find_depth(meta.pages.all)) or "0" - meta.layout = prep_layout(meta.layout or resolve_layout(meta.depth)) + meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth)) if meta.date then meta.date = format_date(meta.date) diff --git a/templates/base.html b/templates/base.html index eb088c4..02ad030 100644 --- a/templates/base.html +++ b/templates/base.html @@ -5,6 +5,9 @@ + $if(redirect)$ + + $endif$ @@ -67,6 +70,8 @@ ${layouts/categorized_list()} $elseif(layout.is_list)$ ${layouts/list()} + $elseif(layout.is_redirect)$ +${layouts/redirect()} $else$ ${layouts/page()} $endif$ diff --git a/templates/layouts/redirect.html b/templates/layouts/redirect.html new file mode 100644 index 0000000..a51d47e --- /dev/null +++ b/templates/layouts/redirect.html @@ -0,0 +1,6 @@ +
+ +
-- cgit v1.2.3-70-g09d2