aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-09-27 01:50:31 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-09-27 01:50:31 +0800
commit520f1f510c5a6acfbdbbec6e6c092fd2bde6b44d (patch)
tree30092968f0682e1ac92e3a154f0f54994cc2d655 /layouts
parent819a25a5ff079a332620e8b21c2a2a2c877efe1a (diff)
downloadrhomepage-520f1f510c5a6acfbdbbec6e6c092fd2bde6b44d.tar.gz
rhomepage-520f1f510c5a6acfbdbbec6e6c092fd2bde6b44d.tar.xz
Add journal year and month indexes
Diffstat (limited to 'layouts')
-rw-r--r--layouts/journal/list.html34
1 files changed, 24 insertions, 10 deletions
diff --git a/layouts/journal/list.html b/layouts/journal/list.html
index dd486ac..4d74990 100644
--- a/layouts/journal/list.html
+++ b/layouts/journal/list.html
@@ -5,15 +5,29 @@
{{ partial "document-view.html" . }}
</header>
{{ .Content }}
- {{- $pages := where site.RegularPages "Section" "journal" -}}
- {{- $pages = $pages.ByDate.Reverse -}}
- <ol class="document-list journal-list">
- {{- range $pages }}
- <li>
- <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time>
- <a href="{{ .RelPermalink }}" lang="{{ .Params.lang }}">{{ .LinkTitle }}</a>
- </li>
- {{- end }}
- </ol>
+ {{- $sections := sort .Sections "RelPermalink" "desc" -}}
+ {{- with $sections }}
+ <section aria-labelledby="journal-sections-title">
+ <h2 id="journal-sections-title">{{ if $.Parent.IsHome }}YEARS{{ else }}MONTHS{{ end }}</h2>
+ <ul class="document-list">
+ {{- range . }}
+ <li><a href="{{ .RelPermalink }}" lang="{{ .Params.lang }}">{{ .LinkTitle }}</a></li>
+ {{- end }}
+ </ul>
+ </section>
+ {{- end }}
+ {{- with .RegularPagesRecursive.ByDate.Reverse }}
+ <section aria-labelledby="journal-entries-title">
+ <h2 id="journal-entries-title">ENTRIES</h2>
+ <ol class="document-list journal-list">
+ {{- range . }}
+ <li>
+ <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "2006-01-02" }}</time>
+ <a href="{{ .RelPermalink }}" lang="{{ .Params.lang }}">{{ .LinkTitle }}</a>
+ </li>
+ {{- end }}
+ </ol>
+ </section>
+ {{- end }}
</article>
{{ end }}