Fix list page and keep list simple

This commit is contained in:
Balakrishnan Balasubramanian 2025-05-13 23:51:16 -04:00
parent e6d8fd1b4e
commit 0a7745a3fe
3 changed files with 26 additions and 66 deletions

View File

@ -3,43 +3,16 @@
{{ .Content }} {{ .Content }}
<div class="title-header"> <div class="title-header">
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
</div> {{ with .OutputFormats.Get "rss" -}}
{{- if gt (len .Sections) 0 }} <a href="{{ .Permalink | safeURL }}">RSS</a>
<h2>Categories</h2> {{ end }}
<ul class="section-list"> </div>
{{- range .Sections }} <ul>
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> {{ range .Pages }}
{{- end }} <li>
</ul> <time>{{ .Date.Format "2006/01/02" }}</time>
<h2>All Posts</h2> <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
{{- end }} </li>
{{- $cs := .CurrentSection }} {{ end }}
{{- with $cs }} </ul>
{{- range (where .Site.RegularPages "Section" .Section) }}
{{- if .IsDescendant $cs }}
<article class="all-list">
<div class="title-list">
<h3><a href="{{ .RelPermalink }}">{{ if .Draft }}<i>(Draft)</i> {{ end }}{{ .Title }}</a></h3>
<div class="title-list-date">
{{- if eq .Date.IsZero false }}
<time>{{ .Date.Format "Monday, January 2, 2006" }}</time>
{{- end }}
{{- if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }}
(updated)
{{- end }}
</div>
</div>
<div class="body-list">
<p></p> {{/* Spacing is weird if we don't include this */}}
<p>
{{ .Summary }}
</p>
{{- if .Truncated }}
<a href="{{ .RelPermalink }}">Read More…</a>
{{- end }}
</div>
</article>
{{- end }}
{{- end }}
{{- end }}
{{ end }} {{ end }}

View File

@ -12,6 +12,12 @@
<a class="btn" href="/tags/{{ . | urlize }}" role="button">{{ . }}</a> <a class="btn" href="/tags/{{ . | urlize }}" role="button">{{ . }}</a>
{{end}} {{end}}
{{end}} {{end}}
{{ if .Params.categories }}
{{range .Params.categories}}
<a class="btn" href="/categories/{{ . | urlize }}" role="button">{{ . }}</a>
{{end}}
{{end}}
{{- if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }} {{- if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }}
&mdash; last updated <time>{{ .Lastmod.Format "January 2, 2006" }}</time> &mdash; last updated <time>{{ .Lastmod.Format "January 2, 2006" }}</time>
{{- end }} {{- end }}

View File

@ -1,31 +1,12 @@
{{ define "main" }} {{ define "main" }}
{{ .Content }} {{ .Content }}
{{ if gt ( len ( where .Site.RegularPages "Section" "posts" )) 0 }} <h2>Posts</h2>
<h2>Recent Posts</h2> <ul>
{{ range first 2 ( where .Site.RegularPages "Section" "posts" ) }} {{ range first 100 ( where .Site.RegularPages "Section" "posts" ) }}
<article class="all-list"> <li>
<div class="title-list"> <time>{{ .Date.Format "2006/01/02" }}</time>
<h3><a href="{{ .RelPermalink }}">{{ if .Draft }}<i>(Draft)</i> {{ end }}{{ .Title }}</a></h3> <a href="{{ .RelPermalink }}">{{ .Title | markdownify }}</a>
<div class="title-list-date"> </li>
{{ if eq .Date.IsZero false }}
<time>{{ .Date.Format "Monday, January 2, 2006" }}</time>
{{ end }}
{{ if (and (eq .Lastmod.IsZero false) (ne .Lastmod .Date)) }}
(updated)
{{ end }}
</div>
</div>
<div class="body-list">
<p></p> {{/* Spacing is weird if we don't include this */}}
<p>
{{ .Summary }}
</p>
{{ if .Truncated }}
<a href="{{ .RelPermalink }}">Read More…</a>
{{ end }}
</div>
<hr>
</article>
{{ end }}
{{ end }} {{ end }}
</ul>
{{ end }} {{ end }}