Improve list pages + support "series"

- Use a <ul>: better accessibility
- Background for individual pages in the list, giving a better feeling
  of separation
- Support "series" taxonomy (displayed oldest to newest)
This commit is contained in:
BBaoVanC 2021-11-12 20:25:47 -06:00
parent 57be090b6a
commit b03fc6c7b1
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
5 changed files with 62 additions and 17 deletions

View File

@ -4,8 +4,22 @@
/* Post layout (in list pages) */
.post {
margin-bottom: 40px;
.page-list ul {
list-style: none;
padding: 0;
}
.page-list li {
padding-top: 8px;
padding-left: 24px;
padding-right: 24px;
padding-bottom: 24px;
border-radius: 12px;
background-color: #222;
}
.page-list li+li {
margin: 40px 0;
}
.post-title {
@ -26,7 +40,7 @@
margin-bottom: 15px;
}
.tags {
.tags, .series {
margin-top: 10px;
}
@ -48,7 +62,7 @@
.section {
margin-bottom: 40px;
background-color: #222;
border-radius: 5px;
border-radius: 12px;
padding: 1px 25px;
}

View File

@ -11,6 +11,7 @@ params:
taxonomies:
tag: tags
author: authors
series: series
privacy:
googleAnalytics:

View File

@ -10,8 +10,9 @@
</span>
</h1>
{{ with .Sections }}
<div class="sections">
{{ range .Sections }}
{{ range . }}
<a class="section-anchor" href="{{ .Permalink }}">
<div class="section">
@ -34,13 +35,18 @@
{{ end }}
</div>
{{ end }}
<div class="posts">
{{ range .Paginator.Pages }}
{{ .Render "summary" }}
{{ else }}
{{ i18n "no_posts" }}
{{ end }}
<div class="page-list">
<ul>
{{ range .Paginator.Pages }}
<li>{{ .Render "summary" }}</li>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</ul>
</div>
{{ if gt .Paginator.TotalPages 1 }}

View File

@ -74,6 +74,17 @@
</span>
{{ end }}
{{ with .Params.series }}
<div class="series">
{{ range ($.GetTerms "series") }}
<span class="post-meta-item">
{{ partial "icon.html" "files" }}
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</span>
{{ end }}
</div>
{{ end }}
<div class="tags">
{{ range (.GetTerms "tags") }}
<span class="post-meta-item">

View File

@ -5,6 +5,8 @@
{{ partial "icon.html" "tag" }}
{{ else if eq .Data.Singular "author" }}
{{ partial "icon.html" "user-circle" }}
{{ else if eq .Data.Singular "series" }}
{{ partial "icon.html" "files" }}
{{ else }}
{{ partial "icon.html" "filter" }}
{{ end }}
@ -30,13 +32,24 @@
</ul>
{{ else }}
{{ range .Paginator.Pages }}
{{ .Render "summary" }}
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ $items := .Paginator.Pages }}
{{ if eq .Data.Singular "series" }}
{{ $items = .Paginator.Pages.Reverse }}
{{ end }}
<div class="page-list">
<ul>
{{ range $items }}
<li>{{ .Render "summary" }}</li>
{{ else }}
<div>
{{ i18n "no_posts" }}
</div>
{{ end }}
</ul>
</div>
{{ if gt .Paginator.TotalPages 1 }}
<div class="pagination">