feat: custom sections, TV series section, fix table wrapping

This commit is contained in:
Ben Goldsworthy 2025-01-12 15:52:54 +01:00
parent 995a539fa9
commit 39c64bf51a
No known key found for this signature in database
17 changed files with 402 additions and 204 deletions

View file

@ -1,5 +1,6 @@
{{ define "title" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }}
{{ .Page.Title | plainify }} |
{{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section{{ end }}
@ -8,42 +9,53 @@
{{ define "item-type" }}{{ .Params.itemsType }}{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
{{- .Scratch.Set "section" ( first 1 ( split .File.Dir "/" ) ) -}}
{{- $section := .Scratch.Get "section" -}}
{{ if ( or ( in "books" ( delimit $section "" ) ) ( in "games" ( delimit $section "" ) ) ) }}
<a href="/{{ delimit $section "" }}/current">Current</a> ~
{{ end }}
<a href="/{{ delimit $section "" }}/log">Log</a> ~
<a href="/{{ delimit $section "" }}/wishlist">Wishlist</a>
<h1 class="page-title">{{ .Title | safeHTML }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}">
<img class="feed-icon" src="/images/feed-icon.svg">
</a>
{{ end }}
</h1>
{{ .Content }}
</header>
{{ end }}
{{ define "main-body" }}
<main class="site-content__body">
{{ if .File }}
<header class="site-content__header">
<h1 class="page-title">
{{ .Title | safeHTML }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}">
<img
class="feed-icon"
src="/images/feed-icon.svg"
/>
</a>
{{ end }}
</h1>
{{ .Scratch.Set "page" ( index ( split .File.Dir "/" ) 1 ) }}
{{ with ( default .Parent.Sections .Sections ) }}
<nav class="section-nav">
<ul>
{{ range .ByWeight }}
<li>
{{ if eq . $.Page }}
<p style="margin: 0;">{{ .Title }}</p>
{{ else }}
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ end }}
</li>
{{ end }}
</ul>
</nav>
{{ end }}
<div class="section__desc">
{{ .Content }}
</div>
</header>
{{ end }}
{{ define "main-body" }}
<main class="site-content__body">
{{ .Scratch.Set "page" .Page.Slug }}
{{ if ( in "current log wishlist" ( .Scratch.Get "page" ) ) }}
{{ if ( eq ( .Scratch.Get "page" ) "current" ) }}
{{ .Scratch.Set "listMode" "current" }}
{{ else if ( eq ( .Scratch.Get "page" ) "log" ) }}
{{ .Scratch.Set "listMode" "log" }}
{{ else if ( eq ( .Scratch.Get "page" ) "wishlist" ) }}
{{ .Scratch.Set "listMode" "wishlist" }}
{{ end }}
{{ partial "stats" . }}
@ -51,6 +63,5 @@
{{ partial "table" . }}
{{ end }}
{{ end }}
</main>
</main>
{{ end }}