aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2025-01-15 00:00:00 +0000
committertdro <tdro@noreply.example.com>2025-01-15 00:00:00 +0000
commit0e52c30f3fda7a4b0e76be161b8b81ec021e8a24 (patch)
treefe8291f3143dd5373f936119928be2c9af351096
parentf13bf7214c669523667e1856a4b33570ad44774f (diff)
downloadcanory-0e52c30f3fda7a4b0e76be161b8b81ec021e8a24.tar.gz
canory-0e52c30f3fda7a4b0e76be161b8b81ec021e8a24.tar.bz2
canory-0e52c30f3fda7a4b0e76be161b8b81ec021e8a24.zip
themes/default/layouts/partials/function-page-modified: Check existence
-rw-r--r--themes/default/layouts/partials/function-page-modified.html21
1 files changed, 12 insertions, 9 deletions
diff --git a/themes/default/layouts/partials/function-page-modified.html b/themes/default/layouts/partials/function-page-modified.html
index 43bea9f..d982507 100644
--- a/themes/default/layouts/partials/function-page-modified.html
+++ b/themes/default/layouts/partials/function-page-modified.html
@@ -1,7 +1,6 @@
-{{- $input := .Context -}}
-{{- $disable := or .Disable false -}}
-{{- $pageContext := $input -}}
-{{- $format := or .Format "index.html" -}}
+{{- $pageContext := .Context -}}
+{{- $disable := or .Disable false -}}
+{{- $format := or .Format "index.html" -}}
{{- $page := print "public/" (strings.TrimPrefix
$pageContext.Page.Site.BaseURL
@@ -9,25 +8,29 @@
) $format
-}}
-{{- $pageModTime := "" -}}
+{{- $pageModTime := "" -}}
{{- $markdownModTime := "" -}}
{{- $markdownContent := print "content/" $pageContext.File -}}
-{{- $markdownPublic := print "public/data/generates/content/" $pageContext.File -}}
+{{- $markdownPublic := print "public/data/generates/content/" $pageContext.File -}}
-{{- if fileExists $markdownContent -}}
+{{- with fileExists $markdownContent -}}
{{- $markdownModTime = (os.Stat $markdownContent).ModTime -}}
{{- end -}}
-{{- if fileExists $markdownPublic -}}
+{{- with fileExists $markdownPublic -}}
{{- $markdownModTime = (os.Stat $markdownPublic).ModTime -}}
{{- end -}}
-{{- if fileExists $page -}}
+{{- with fileExists $page -}}
{{- $pageModTime = (os.Stat $page).ModTime -}}
{{- end -}}
{{- $page = gt $markdownModTime $pageModTime -}}
+{{- with not (resources.Get $page) -}}
+ {{- $page = true -}}
+{{- end -}}
+
{{- $modified := or $page (in (slice
"home"
"section"