commit 27755bb9d1b2805c940dbad012190788cc4ed6ab
parent d0881d36dfac9ed9351a0f40610a0255588d7893
Author: Lou Woell <lou.woell@posteo.de>
Date: Thu, 16 Oct 2025 14:16:09 +0200
restructure list view
- remove duplicated list elements code
- new naming convention terms.html -> taxonomy.html
- include series title in list view
Diffstat:
7 files changed, 104 insertions(+), 135 deletions(-)
diff --git a/assets/css/post.scss b/assets/css/post.scss
@@ -46,7 +46,7 @@
$border: 3px dotted $accent;
position: relative;
color: $accent;
- margin: 0.25rem 2px 0.5rem;
+ margin: 0 2px 0.5rem;
padding-bottom: 15px;
border-bottom: $border;
@@ -64,6 +64,16 @@
}
}
+ &-series {
+ margin: 0;
+ margin-left: 2px;
+ font-style: italic;
+ opacity: .5;
+ a {
+ text-decoration: none;
+ }
+ }
+
&-tags {
display: block;
margin-left: 2px;
diff --git a/layouts/_partials/post-on-list.html b/layouts/_partials/post-on-list.html
@@ -0,0 +1,42 @@
+<article class="post on-list">
+ {{ with .Params.series -}}
+ <span class="post-series">
+ <a href= "{{ (urlize (printf "series/%s/" . )) | absLangURL }}">
+ {{- . -}}:
+ </a>
+ </span>
+ {{- end }}
+
+ <h1 class="post-title">
+ <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
+ </h1>
+ {{- if .Params.tags }}
+ <span class="post-tags">
+ {{- range .Params.tags }}
+ #<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
+ {{- . -}}
+ </a>
+ {{- end }}
+ </span>
+ {{ end -}}
+
+ {{ if .Params.cover -}}
+ <div class="post-preview-grid">
+ {{ partial "cover.html" . }}
+ {{- end }}
+
+ <div class="post-description">
+ {{ if .Description -}}
+ {{ .Description | markdownify -}}
+ {{ else -}}
+ {{ .Summary | plainify -}}
+ {{- end }}
+ </div>
+
+ <a class="read-more button" href="{{.RelPermalink}}">
+ {{ $.Site.Params.ReadMore }} →
+ </a>
+ {{ if .Params.cover -}}
+ </div>
+ {{- end }}
+</article>
diff --git a/layouts/list.html b/layouts/list.html
@@ -6,54 +6,8 @@
{{ end }}
<div class="posts">
{{ range .Paginator.Pages }}
- <article class="post on-list">
- {{ if .Params.tags }}
- <span class="post-tags">
- {{ range .Params.tags }}
- #<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
- {{- . -}}
- </a>
- {{ end }}
- </span>
- {{ end }}
- <h1 class="post-title">
- <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
- </h1>
- <div class="post-meta">
- {{- if .Date -}}
- <time class="post-date">
- {{- .Date.Format "2006-01-02" -}}
- </time>
- {{- end -}}
- {{- with .Params.Author -}}
- <span class="post-author">{{- . -}}</span>
- {{- end -}}
- </div>
-
- {{ if .Params.cover }}
- <div class="post-preview-grid">
- {{ partial "cover.html" . }}
- {{ end }}
-
- <div class="post-description">
- {{ if .Description }}
- {{ .Description | markdownify }}
- {{ else }}
- {{ .Summary | plainify }}
- {{ end }}
- </div>
-
- <a class="read-more button" href="{{.RelPermalink}}">
- {{ $.Site.Params.ReadMore }} →
- </a>
-
- {{ if .Params.cover }}
- </div>
- {{ end }}
-
- </article>
+ {{ partial "post-on-list.html" . }}
{{ end }}
-
{{ partial "pagination.html" . }}
</div>
{{ end }}
diff --git a/layouts/single.html b/layouts/single.html
@@ -1,13 +1,24 @@
{{ define "main" }}
<article class="post">
+ {{- with .Params.series -}}
+ <h3 class="post-series">
+ <a href= "{{ (urlize (printf "series/%s/" . )) | absLangURL }}">
+ {{- . -}}
+ </a>
+ </h3>
+ {{- end -}}
+
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
- #<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>
+ #<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">
+ {{- . -}}
+ </a>
{{ end }}
</span>
{{ end }}
+
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</h1>
@@ -28,13 +39,6 @@
{{- if and (.Param "readingTime") (eq (.Param "readingTime") true) -}}
<span class="post-reading-time">{{ .ReadingTime }} {{ $.Site.Params.minuteReadingTime | default "min read" }} ({{ .WordCount }} {{ $.Site.Params.words | default "words" }})</span>
{{- end -}}
- {{- if .Params.series -}}
- <span class ="series">
- {{- with .Params.series -}}
- Part of the <a href="{{ (urlize (printf "series/%s/" . )) | absLangURL }}"> {{ . }}</a> series.
- {{- end -}}
- </span>
- {{- end -}}
</div>
{{ partial "cover.html" . }}
diff --git a/layouts/taxonomy.html b/layouts/taxonomy.html
@@ -0,0 +1,24 @@
+{{ define "main" }}
+ <div class="terms">
+ <h1>{{ .Title }}</h1>
+ {{ with .Content }}
+ <div class="index-content">
+ {{ . }}
+ </div>
+ {{ end }}
+ <ul>
+ {{ $type := .Type }}
+ {{ range $key, $value := .Data.Terms.Alphabetical }}
+ {{ $name := .Name }}
+ {{ $count := .Count }}
+ {{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
+ <li>
+ <a class="terms-title" href="{{ .Permalink }}">
+ {{- .Name }} [{{ $count }}]
+ </a>
+ </li>
+ {{ end }}
+ {{ end }}
+ </ul>
+ </div>
+{{ end }}
diff --git a/layouts/term.html b/layouts/term.html
@@ -1,57 +1,14 @@
-{{ define "main" }}
- <h1>Posts for: #{{ .Title }}</h1>
- {{ with .Content }}
- <div class="index-content">
- {{ . }}
- </div>
- {{ end }}
- <div class="posts">
- {{ range .Paginator.Pages }}
- <article class="post on-list">
- <h1 class="post-title">
- <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
- </h1>
- <div class="post-meta">
- {{- if .Date -}}
- <time class="post-date">
- {{- .Date.Format "2006-01-02" -}}
- </time>
- {{- end -}}
- {{- with .Params.Author -}}
- <span class="post-author">{{- . -}}</span>
- {{- end -}}
- </div>
-
- {{ if .Params.tags }}
- <span class="post-tags">
- {{ range .Params.tags }}
- #<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
- {{- . -}}
- </a>
- {{ end }}
- </span>
- {{ end }}
-
- {{ partial "cover.html" . }}
-
- <div class="post-content">
- {{ if .Params.showFullContent }}
- {{ .Content }}
- {{ else if .Description }}
- {{ .Description | markdownify }}
- {{ else }}
- {{ .Summary }}
- {{ end }}
- </div>
-
- {{ if not .Params.showFullContent }}
- <div>
- <a class="read-more button" href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
- </div>
- {{ end }}
- </article>
- {{ end }}
-
- {{ partial "pagination.html" . }}
- </div>
-{{ end }}
+{{ define "main" }}
+ <h1>{{ .Title }}</h1>
+ {{ with .Content }}
+ <div class="index-content">
+ {{ . }}
+ </div>
+ {{ end }}
+ <div class="posts">
+ {{ range .Paginator.Pages }}
+ {{ partial "post-on-list.html" . }}
+ {{ end }}
+ {{ partial "pagination.html" . }}
+ </div>
+{{ end }}
diff --git a/layouts/terms.html b/layouts/terms.html
@@ -1,22 +0,0 @@
-{{ define "main" }}
- <div class="terms">
- <h1>{{ .Title }}</h1>
- {{ with .Content }}
- <div class="index-content">
- {{ . }}
- </div>
- {{ end }}
- <ul>
- {{ $type := .Type }}
- {{ range $key, $value := .Data.Terms.Alphabetical }}
- {{ $name := .Name }}
- {{ $count := .Count }}
- {{ with $.Site.GetPage (printf "/%s/%s" $type $name) }}
- <li>
- <a class="terms-title" href="{{ .Permalink }}">{{ .Name }} [{{ $count }}]</a>
- </li>
- {{ end }}
- {{ end }}
- </ul>
- </div>
-{{ end }}