aboutsummaryrefslogtreecommitdiff
path: root/layouts/blog
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@vidhukant.xyz>2023-01-05 20:15:27 +0530
committerVidhu Kant Sharma <vidhukant@vidhukant.xyz>2023-01-05 20:15:27 +0530
commitefbe64374708fe253fe988d47a4bd3142d98fe42 (patch)
tree982ffe5698144e14d533740abfaf37980278bc9b /layouts/blog
parent451f37329c53dcf564a8cf79d6d901621eadec17 (diff)
Properly showing list of blog posts per year
Diffstat (limited to 'layouts/blog')
-rw-r--r--layouts/blog/list.html35
1 files changed, 23 insertions, 12 deletions
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
index 1aa589a..044f587 100644
--- a/layouts/blog/list.html
+++ b/layouts/blog/list.html
@@ -2,19 +2,30 @@
<div class="list">
<h1>{{ if .Params.heading }}{{ .Params.heading }}{{ else }}{{ .Title }}{{ end }}</h1>
{{ .Content }}
+
+ {{ if .Sections }}
{{ range .Sections.ByDate.Reverse }}
- <h2 class="section" id="{{ .Title }}">{{ .Title }}:</h2>
- <ul>
- {{ range (union .Sections .Pages).ByDate.Reverse }}
- <li>
- <p>
- <a href="{{ .RelPermalink }}">{{ .Title }}</a>
- <sup>{{ .Date.Format "2" }}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }} {{ .Date.Format "January" }}</sup>
- </p>
- </li>
- {{ end }}
- </ul>
+ <a href="{{ .RelPermalink }}">
+ <h2 class="section" id="{{ .Title }}">{{ .Title }}:</h2>
+ </a>
+ {{ range (union .Sections .Pages).ByDate.Reverse }}
+ <p>
+ <a href="{{ .RelPermalink }}">{{ .Title }}</a>
+ <sup>
+ {{ .Date.Format "2" }}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }} {{ .Date.Format "January" }}
+ </sup>
+ </p>
+ {{ end }}
+ {{ end }}
+ {{ else }}
+ {{ range (union .Sections .Pages).ByDate.Reverse }}
+ <p>
+ <a href="{{ .RelPermalink }}">{{ .Title }}</a>
+ <sup>
+ {{ .Date.Format "2" }}{{ if in (slice 1 21 31) .Date.Day}}st{{ else if in (slice 2 22) .Date.Day}}nd{{ else if in (slice 3 23) .Date.Day}}rd{{ else }}th{{ end }} {{ .Date.Format "January" }}
+ </sup>
+ </p>
{{ end }}
+ {{ end }}
</div>
{{ end }}
-