diff options
| author | verdant <im@verdant.ee> | 2026-05-31 16:36:13 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-05-31 16:36:13 +0800 |
| commit | d91f48c4945acd1b9f76a79d7804580b70b0c2df (patch) | |
| tree | 6844217a5b61d31d6d2a837fb708db411825bc5c /layouts/archives | |
| parent | 7876c3763897092266e535cd464d45637862d73b (diff) | |
| download | blog-d91f48c4945acd1b9f76a79d7804580b70b0c2df.tar.gz blog-d91f48c4945acd1b9f76a79d7804580b70b0c2df.zip | |
Refactor: remove bloated CSS style and nested HTML layouts
Diffstat (limited to 'layouts/archives')
| -rw-r--r-- | layouts/archives/single.html | 92 |
1 files changed, 35 insertions, 57 deletions
diff --git a/layouts/archives/single.html b/layouts/archives/single.html index dc089ff..83436ac 100644 --- a/layouts/archives/single.html +++ b/layouts/archives/single.html @@ -1,66 +1,44 @@ {{ define "main" }} <header> -<a href="{{ "" | relURL }}" class="title"> - <p class="site-title">{{ .Site.Title }}</p> -</a> -<nav>{{- partial "nav.html" . -}}</nav> + <a href={{ "" | relURL }} class=title><p class=site-title>{{ .Site.Title }}</p></a> + <nav>{{ partial "nav.html" . }}</nav> </header> +<main> + {{ if .Data.Singular }} + <h3 style="margin-bottom:0">Filtering for "{{ .Title }}"</h3> + <small><a href={{ "blog" | relURL }}>Remove filter</a></small> + {{ end }} -<content> - {{ if .Data.Singular }} - <h3 style="margin-bottom:0">Filtering for "{{ .Title }}"</h3> - <small> - <a href="{{ "blog" | relURL }}">Remove filter</a> - </small> - {{ end }} - - {{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }} - {{ $excludePosts := where $allPosts "Params.categories" "intersect" (slice "1") }} - {{ $postPages := ($allPosts | complement $excludePosts) }} - - {{ if .Site.Params.showPostCount }} - <p id="post-count">There {{ if le (len $postPages) 1 }} is {{ len $postPages }} piece. {{ else }} are {{ len $postPages }} pieces. {{ end }}</p> - {{ end }} + {{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }} + {{ $excludePosts := where $allPosts "Params.categories" "intersect" (slice "1") }} + {{ $postPages := ($allPosts | complement $excludePosts) }} - <ul class="blog-posts"> - {{ $currentYear := 0 }} - {{ range $postPages }} - {{ if .Site.Params.groupByYear }} - {{ $year := .Date.Year }} - {{ if ne $year $currentYear }} - <h3>{{ $year }}</h3> - {{ $currentYear = $year }} + <ul class=blog-posts> + {{ $currentYear := 0 }} + {{ range $postPages }} + {{ $year := .Date.Year }} + {{ if ne $year $currentYear }} + <h3>{{ $year }}</h3> + {{ $currentYear = $year }} + {{ end }} + <li> + <time datetime={{ .Date.Format "2006-01-02" }} pubdate>{{ .Date.Format "2006-01-02" }}</time> + <a href={{ .Permalink }}>{{ .Title }}</a> + </li> + {{ else }} + <li>No posts yet</li> {{ end }} - {{ end }} - <li> - <span class="{{ if .Site.Params.groupByYear }} grouped {{ else }} ungrouped {{ end }}"> - <i> - <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate> - {{ if .Site.Params.groupByYear }} - {{ .Date.Format (default "2006-01-02" .Site.Params.dateFormat) }} - {{ else }} - {{ .Date.Format (default "02 Jan, 2006" .Site.Params.dateFormat) }} - {{ end }} - </time> - </i> - </span> - <a style="border: none;" href="{{ .Permalink }}">{{ .Title }}</a> - </li> - {{ else }} - <li>No posts yet</li> - {{ end }} - </ul> + </ul> - {{ if .Data.Singular }} - {{ else }} - <small> - <div> - {{ range .Site.Taxonomies.tags }} - <a href="{{ .Page.Permalink }}">#{{ .Page.Title }}</a> - {{ end }} - </div> - </small> - {{ end }} -</content> + {{ if not .Data.Singular }} + <footer> + <nav class=tags> + {{ range .Site.Taxonomies.tags }} + <a href={{ .Page.Permalink }}>#{{ .Page.Title }}</a> + {{ end }} + </nav> + </footer> + {{ end }} +</main> {{ end }} |
