Cataloguer/layouts/_default/section.html

57 lines
1.6 KiB
HTML
Raw Normal View History

2022-12-17 18:41:44 +00:00
{{ define "title" }}
{{ .Page.Title | plainify }} | {{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section{{ end }}
{{ define "main-type" }}.{{ .Params.mainType }}{{ end }}
{{ 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" -}}
2023-10-05 18:27:13 +00:00
{{ if ( or ( in "books" ( delimit $section "" ) ) ( in "games" ( delimit $section "" ) ) ) }}
2023-01-29 18:44:51 +00:00
<a href="/{{ delimit $section "" }}/current">Current</a> ~
{{ end }}
<a href="/{{ delimit $section "" }}/log">Log</a> ~
2022-12-17 18:41:44 +00:00
<a href="/{{ delimit $section "" }}/wishlist">Wishlist</a>
<h1 class="page-title">{{ .Title | safeHTML }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}">
2023-10-05 18:27:13 +00:00
<img class="feed-icon" src="/images/feed-icon.svg">
2022-12-17 18:41:44 +00:00
</a>
{{ end }}
</h1>
{{ .Content }}
</header>
{{ end }}
{{ define "main-body" }}
<main class="site-content__body">
2022-12-17 18:41:44 +00:00
{{ if .File }}
2022-12-17 18:41:44 +00:00
{{ .Scratch.Set "page" ( index ( split .File.Dir "/" ) 1 ) }}
2023-01-29 18:44:51 +00:00
{{ if ( in "current log wishlist" ( .Scratch.Get "page" ) ) }}
2023-01-29 18:44:51 +00:00
{{ if ( eq ( .Scratch.Get "page" ) "current" ) }}
{{ .Scratch.Set "listMode" "current" }}
2023-01-29 18:44:51 +00:00
{{ else if ( eq ( .Scratch.Get "page" ) "log" ) }}
2022-12-17 18:41:44 +00:00
{{ .Scratch.Set "listMode" "log" }}
2022-12-17 18:41:44 +00:00
{{ else if ( eq ( .Scratch.Get "page" ) "wishlist" ) }}
{{ .Scratch.Set "listMode" "wishlist" }}
2022-12-17 18:41:44 +00:00
{{ end }}
{{ partial "stats" . }}
2022-12-17 18:41:44 +00:00
{{ partial "table" . }}
2022-12-17 18:41:44 +00:00
{{ end }}
{{ end }}
</main>
{{ end }}