summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-11-14 12:46:40 +0100
committerVolpeon <git@volpeon.ink>2021-11-14 12:46:40 +0100
commit84566a32b1b0cf4fa57bb9d5409ee794deceab7f (patch)
treee4a106bae2678d2173569cdf1c889a0544d02b06
parentList generation: Handle empty subpages list better (diff)
downloadvolpeon.ink-84566a32b1b0cf4fa57bb9d5409ee794deceab7f.tar.gz
volpeon.ink-84566a32b1b0cf4fa57bb9d5409ee794deceab7f.tar.bz2
volpeon.ink-84566a32b1b0cf4fa57bb9d5409ee794deceab7f.zip
Added redirect fallback template
-rw-r--r--scripts/metadata_filter.lua3
-rw-r--r--templates/base.html5
-rw-r--r--templates/layouts/redirect.html6
3 files changed, 13 insertions, 1 deletions
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
259function process(global, parent, meta) 259function process(global, parent, meta)
260 meta.namespace = resolve_namespace(meta.namespace) 260 meta.namespace = resolve_namespace(meta.namespace)
261 meta.file_out = pandoc.utils.stringify(meta.file_out):gsub("^out", "") 261 meta.file_out = pandoc.utils.stringify(meta.file_out):gsub("^out", "")
262 meta.redirect = meta.url and true
262 meta.url = meta.url and pandoc.utils.stringify(meta.url) 263 meta.url = meta.url and pandoc.utils.stringify(meta.url)
263 meta.url = resolve_url(global.site.url, global.file_out, meta.url or meta.file_out) 264 meta.url = resolve_url(global.site.url, global.file_out, meta.url or meta.file_out)
264 meta.title = (meta.title and pandoc.utils.stringify(meta.title)) or "" 265 meta.title = (meta.title and pandoc.utils.stringify(meta.title)) or ""
@@ -292,7 +293,7 @@ function process(global, parent, meta)
292 meta.pages = 293 meta.pages =
293 process_pages(global, { parent = parent, meta = meta }, meta.list_order, meta.pages) 294 process_pages(global, { parent = parent, meta = meta }, meta.list_order, meta.pages)
294 meta.depth = (meta.pages and find_depth(meta.pages.all)) or "0" 295 meta.depth = (meta.pages and find_depth(meta.pages.all)) or "0"
295 meta.layout = prep_layout(meta.layout or resolve_layout(meta.depth)) 296 meta.layout = prep_layout(meta.layout or (meta.redirect and "redirect") or resolve_layout(meta.depth))
296 297
297 if meta.date then 298 if meta.date then
298 meta.date = format_date(meta.date) 299 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 @@
5 <meta charset="utf-8" /> 5 <meta charset="utf-8" />
6 <meta name="viewport" content="width=device-width, initial-scale=1" /> 6 <meta name="viewport" content="width=device-width, initial-scale=1" />
7 <meta name="robots" content="noindex" /> 7 <meta name="robots" content="noindex" />
8 $if(redirect)$
9 <meta http-equiv="refresh" content="3; URL=$url.full$">
10 $endif$
8 11
9 <link rel="canonical" href="$url.full$"> 12 <link rel="canonical" href="$url.full$">
10 <link rel="shortcut icon" href="/favicon.ico" /> 13 <link rel="shortcut icon" href="/favicon.ico" />
@@ -67,6 +70,8 @@
67${layouts/categorized_list()} 70${layouts/categorized_list()}
68 $elseif(layout.is_list)$ 71 $elseif(layout.is_list)$
69${layouts/list()} 72${layouts/list()}
73 $elseif(layout.is_redirect)$
74${layouts/redirect()}
70 $else$ 75 $else$
71${layouts/page()} 76${layouts/page()}
72 $endif$ 77 $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 @@
1<div class="s-body">
2 <section class="l-container l-container--pad-x l-container--pad-y l-container--content s-colored-links s-headlines">
3 <h1 class="u-mt0"><span class="s-headlines__title-inner">Redirect</span></h1>
4 <p>This page should redirect you to <a href="$url.full$">$url.full$</a> in 3 seconds.</p>
5 </section>
6</div>