aboutsummaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-02-06 20:46:23 -0500
committertdro <tdro@noreply.example.com>2023-02-06 20:46:23 -0500
commit017bc1c9317ab352981202dc7da0e3f9dc314043 (patch)
tree07bc1c91eb7f12142bb89e09a417a559c1af3296 /themes
parentca11dd33ec93a4d9077bb1d8d6f3cc58e269e55e (diff)
downloadcanory-017bc1c9317ab352981202dc7da0e3f9dc314043.tar.gz
canory-017bc1c9317ab352981202dc7da0e3f9dc314043.tar.bz2
canory-017bc1c9317ab352981202dc7da0e3f9dc314043.zip
themes/default/layouts/partials: Add page modification detection
But don't use it
Diffstat (limited to 'themes')
-rw-r--r--themes/default/layouts/_default/baseof.html2
-rw-r--r--themes/default/layouts/_default/baseof.txt2
-rw-r--r--themes/default/layouts/partials/function-page-modified.html21
3 files changed, 25 insertions, 0 deletions
diff --git a/themes/default/layouts/_default/baseof.html b/themes/default/layouts/_default/baseof.html
index c42b7ae..ddd2780 100644
--- a/themes/default/layouts/_default/baseof.html
+++ b/themes/default/layouts/_default/baseof.html
@@ -1,3 +1,5 @@
+{{- $modified := partial "function-page-modified.html" . -}}
+
<!DOCTYPE html>
<html
lang="en-us"
diff --git a/themes/default/layouts/_default/baseof.txt b/themes/default/layouts/_default/baseof.txt
index 02f0046..55f860c 100644
--- a/themes/default/layouts/_default/baseof.txt
+++ b/themes/default/layouts/_default/baseof.txt
@@ -1,3 +1,5 @@
+{{- $modified := partial "function-page-modified.html" . -}}
+
{{- block "main" . -}}
Silence is golden.
{{- end -}}
diff --git a/themes/default/layouts/partials/function-page-modified.html b/themes/default/layouts/partials/function-page-modified.html
new file mode 100644
index 0000000..f03ee6f
--- /dev/null
+++ b/themes/default/layouts/partials/function-page-modified.html
@@ -0,0 +1,21 @@
+{{- $input := . -}}
+{{- $pageContext := $input -}}
+
+{{- $markdown := print "content/" $pageContext.File -}}
+{{- $markdownModTime := "" -}}
+{{- $page := print "public" (strings.TrimPrefix $pageContext.Page.Site.BaseURL $pageContext.Page.Permalink) "index.html" -}}
+{{- $pageModTime := "" -}}
+
+{{- if fileExists $markdown -}}
+ {{- $markdownModTime = (os.Stat $markdown).ModTime -}}
+{{- end -}}
+
+{{- if fileExists $page -}}
+ {{- $pageModTime = (os.Stat $page).ModTime -}}
+{{- end -}}
+
+{{- $modified := gt $markdownModTime $pageModTime -}}
+
+{{- $output := or $modified (in (slice "home" "section" "taxonomy" "term") $pageContext.Page.Kind) -}}
+
+{{- return $output -}}