1

Taxonomies

This commit is contained in:
2025-11-05 10:53:33 +01:00
parent f6e16046e7
commit 4fedc0a056
9 changed files with 78 additions and 21 deletions

View File

@@ -5,6 +5,11 @@ article.article-body {
padding: var(--padding) 0; padding: var(--padding) 0;
font-size: 1.5rem; font-size: 1.5rem;
aside {
margin: var(--margin);
font-size: 1.2rem;
}
.stat { .stat {
max-width: var(--width-content-max); max-width: var(--width-content-max);
margin: var(--margin) auto; margin: var(--margin) auto;

View File

@@ -25,3 +25,4 @@
@import "pagination.css"; @import "pagination.css";
@import "table-of-contents.css"; @import "table-of-contents.css";
@import "a.css"; @import "a.css";
@import "keywords.css";

View File

@@ -0,0 +1,12 @@
ul.keywords {
margin: var(--margin) auto;
padding-left: 0;
line-height: 150%;
display: flex;
flex-wrap: wrap;
gap: var(--gap-half);
list-style: none;
max-width: var(--width-content-max);
width: 100%;
font-size: 1rem;
}

View File

@@ -1,19 +1,39 @@
{{- $page := . -}} {{- $page := . -}}
{{- with .Page -}} {{- with .Page }}{{ $page = . }}{{ end -}}
{{- $page = . -}} {{- $trail := slice -}}
{{- end -}} {{- if $page }}
{{- if or $page.IsPage $page.IsSection -}}
{{- $trail := slice -}}
{{- range $page.Ancestors.Reverse -}} {{- range $page.Ancestors.Reverse -}}
{{- if ne .RelPermalink "/" -}} {{- if ne .RelPermalink "/" -}}
{{- $trail = $trail | append . -}} {{- $trail = $trail | append . -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if gt (len $trail) 0 -}}
<nav class="breadcrumbs" aria-label="Fil dAriane"> {{- if eq $page.Kind "term" }}
{{- range $item := $trail -}} {{- with site.GetPage "taxonomy" $page.Data.Plural }}
<a href="{{ $item.RelPermalink }}">{{ with $item.LinkTitle }}{{ . }}{{ else }}{{ $item.Title }}{{ end }}</a> {{- range .Ancestors.Reverse -}}
{{- if ne .RelPermalink "/" -}}
{{- if not (in $trail .) -}}
{{- $trail = $trail | append . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if not (in $trail .) -}}
{{- $trail = $trail | append . -}}
{{- end -}}
{{- end -}} {{- end -}}
</nav> {{- else if and (eq $page.Kind "taxonomy") (eq (len $trail) 0) }}
{{- with site.Home }}
{{- if ne .RelPermalink "/" -}}
{{- $trail = $trail | append . -}}
{{- end -}}
{{- end -}}
{{- end }}
{{- end }}
{{- if gt (len $trail) 0 -}}
<nav class="breadcrumbs" aria-label="Fil dAriane">
{{- range $item := $trail -}}
<a href="{{ $item.RelPermalink }}">{{ with $item.LinkTitle }}{{ . }}{{ else }}{{ $item.Title }}{{ end }}</a>
{{- end -}} {{- end -}}
</nav>
{{- end -}} {{- end -}}

View File

@@ -1,4 +1,4 @@
<header id="hero-page" class="panel-hero"> <header id="hero-page" class="panel panel-hero">
{{ partialCached "site-title.html" . }} {{ partialCached "site-title.html" . }}
<div class="page-meta"> <div class="page-meta">
{{ partial "breadcrumbs.html" . }} {{ partial "breadcrumbs.html" . }}

View File

@@ -0,0 +1,13 @@
{{- $items := . -}}
{{- if gt (len $items) 0 -}}
<ul class="keywords">
{{- range $items }}
{{- $type := printf "%T" . -}}
{{- if or (strings.HasPrefix $type "*hugolib.") (strings.HasPrefix $type "page.") }}
<li><a href="{{ .RelPermalink }}">{{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }}</a></li>
{{- else }}
<li>{{ . }}</li>
{{- end }}
{{- end }}
</ul>
{{- end }}

View File

@@ -25,6 +25,8 @@
{{ end }} {{ end }}
{{ .Content }} {{ .Content }}
{{- partial "asides/keywords.html" . }}
</article> </article>
</main> </main>
{{ end }} {{ end }}

View File

@@ -1,7 +1,10 @@
{{ define "main" }} {{ define "main" }}
<h1>{{ .Title }}</h1> {{ partial "hero-section.html" . }}
<main>
{{ .Content }} {{ .Content }}
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> {{- with .Pages }}
{{ end }} {{- partial "keywords.html" (.ByTitle) }}
{{- end }}
</main>
{{ end }} {{ end }}

View File

@@ -1,7 +1,8 @@
{{ define "main" }} {{ define "main" }}
<h1>{{ .Title }}</h1> {{ partial "hero-section.html" . }}
<main>
{{ .Content }} {{ .Content }}
{{ range .Pages }}
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2> {{- partial "articles-list.html" (dict "Pages" .Pages.ByDate.Reverse "Context" .) -}}
{{ end }} </main>
{{ end }} {{ end }}