summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archetypes/journal.md4
-rw-r--r--archetypes/note.md2
-rw-r--r--hugo.toml4
-rw-r--r--layouts/journal/single.html6
-rw-r--r--layouts/notes/single.html6
5 files changed, 11 insertions, 11 deletions
diff --git a/archetypes/journal.md b/archetypes/journal.md
index b15421e..dfcc43a 100644
--- a/archetypes/journal.md
+++ b/archetypes/journal.md
@@ -2,7 +2,7 @@
title: "{{ replace .File.ContentBaseName "-" " " | title }}"
slug: "{{ .File.ContentBaseName }}"
lang: en
-date: {{ .Date.Format "2006-01-02" }}
+created: {{ .Date.Format "2006-01-02" }}
+updated: {{ .Date.Format "2006-01-02" }}
license: CC-BY-SA-4.0
---
-
diff --git a/archetypes/note.md b/archetypes/note.md
index dbfe4fc..dfcc43a 100644
--- a/archetypes/note.md
+++ b/archetypes/note.md
@@ -2,7 +2,7 @@
title: "{{ replace .File.ContentBaseName "-" " " | title }}"
slug: "{{ .File.ContentBaseName }}"
lang: en
+created: {{ .Date.Format "2006-01-02" }}
updated: {{ .Date.Format "2006-01-02" }}
license: CC-BY-SA-4.0
---
-
diff --git a/hugo.toml b/hugo.toml
index c266924..ed3e4d7 100644
--- a/hugo.toml
+++ b/hugo.toml
@@ -17,6 +17,10 @@ enableRobotsTXT = false
gitBase = "https://codeberg.org/Richard-Qin/rhomepage/src/branch/main"
contentLicense = "CC BY-SA 4.0"
+[frontmatter]
+ date = ["created"]
+ lastmod = ["updated"]
+
[permalinks]
journal = "/:year/:month/:slug"
notes = "/:sections/:slug"
diff --git a/layouts/journal/single.html b/layouts/journal/single.html
index d687be1..38c6a96 100644
--- a/layouts/journal/single.html
+++ b/layouts/journal/single.html
@@ -4,10 +4,8 @@
<p class="document-path">{{ .RelPermalink }}</p>
<h1>{{ .Title }}</h1>
<dl class="document-meta">
- <div><dt>published</dt><dd><time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time></dd></div>
- {{- with .Params.updated }}
- <div><dt>updated</dt><dd><time datetime="{{ time.Format "2006-01-02" . }}">{{ time.Format "2006-01-02" . }}</time></dd></div>
- {{- end }}
+ <div><dt>created</dt><dd><time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time></dd></div>
+ <div><dt>updated</dt><dd><time datetime="{{ .Lastmod.Format "2006-01-02" }}">{{ .Lastmod.Format "2006-01-02" }}</time></dd></div>
<div><dt>license</dt><dd>{{ .Params.license }}</dd></div>
</dl>
{{ partial "document-view.html" . }}
diff --git a/layouts/notes/single.html b/layouts/notes/single.html
index ec3545a..35f179d 100644
--- a/layouts/notes/single.html
+++ b/layouts/notes/single.html
@@ -5,10 +5,8 @@
<h1>{{ .Title }}</h1>
{{- with .Params.series }}{{ partial "series-nav.html" (dict "page" $ "mode" "position") }}{{ end }}
<dl class="document-meta">
- {{- with .Params.created }}
- <div><dt>created</dt><dd><time datetime="{{ time.Format "2006-01-02" . }}">{{ time.Format "2006-01-02" . }}</time></dd></div>
- {{- end }}
- <div><dt>updated</dt><dd><time datetime="{{ time.Format "2006-01-02" .Params.updated }}">{{ time.Format "2006-01-02" .Params.updated }}</time></dd></div>
+ <div><dt>created</dt><dd><time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time></dd></div>
+ <div><dt>updated</dt><dd><time datetime="{{ .Lastmod.Format "2006-01-02" }}">{{ .Lastmod.Format "2006-01-02" }}</time></dd></div>
<div><dt>license</dt><dd>{{ .Params.license }}</dd></div>
</dl>
{{ partial "document-view.html" . }}