Apparence et navigation dans les taxonomies
This commit is contained in:
@@ -9,4 +9,9 @@ ul.keywords {
|
||||
max-width: var(--width-content-max);
|
||||
width: 100%;
|
||||
font-size: 1rem;
|
||||
|
||||
li {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
--padding-hero-panel: var(--padding-panel);
|
||||
--footer-padding: var(--padding);
|
||||
--list-padding: var(--padding-double);
|
||||
--padding-keyword: var(--padding-half);
|
||||
|
||||
--gap: 1.5rem;
|
||||
--gap-half: 0.75rem;
|
||||
@@ -40,4 +41,4 @@
|
||||
|
||||
--grid-columns: 4;
|
||||
--width-card-min: 300px;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,20 @@
|
||||
{{- $page := . -}}
|
||||
{{- with .Page }}{{ $page = . }}{{ end -}}
|
||||
{{- $taxonomiesRoot := site.GetPage "section" "taxonomies" -}}
|
||||
{{- $trail := slice -}}
|
||||
{{- if $page }}
|
||||
{{- $isTaxonomy := or (eq $page.Kind "taxonomy") (eq $page.Kind "term") -}}
|
||||
{{- if and $isTaxonomy $taxonomiesRoot -}}
|
||||
{{- if not (in $trail $taxonomiesRoot) -}}
|
||||
{{- $trail = $trail | append $taxonomiesRoot -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- range $page.Ancestors.Reverse -}}
|
||||
{{- if ne .RelPermalink "/" -}}
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- if not (in $trail .) -}}
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -21,10 +31,12 @@
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- else if and (eq $page.Kind "taxonomy") (eq (len $trail) 0) }}
|
||||
{{- with site.Home }}
|
||||
{{- if ne .RelPermalink "/" -}}
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- else if eq $page.Kind "taxonomy" }}
|
||||
{{- if and (eq (len $trail) 0) (not $taxonomiesRoot) }}
|
||||
{{- with site.Home }}
|
||||
{{- if ne .RelPermalink "/" -}}
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
|
||||
@@ -3,11 +3,19 @@
|
||||
<ul class="keywords">
|
||||
{{- range (sort $items "Title") }}
|
||||
{{- $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 }}
|
||||
{{- $isPage := or (strings.HasPrefix $type "*hugolib.") (strings.HasPrefix $type "page.") -}}
|
||||
<li>
|
||||
{{- if $isPage -}}
|
||||
<a href="{{ .RelPermalink }}">{{ with .LinkTitle }}{{ . }}{{ else }}{{ .Title }}{{ end }}</a>
|
||||
{{ with .Pages -}}
|
||||
<sub>{{ len . }}</sub>
|
||||
{{- else -}}
|
||||
<sub>0</sub>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{ . }}<sub>—</sub>
|
||||
{{- end }}
|
||||
</li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<div class="page-meta">
|
||||
{{ with .Date }}
|
||||
<time datetime="{{ . }}">{{ . | time.Format ":date_long" }}</time>
|
||||
{{ with .Params.date }}
|
||||
{{- $date := time.AsTime . -}}
|
||||
<time datetime="{{ time.Format "2006-01-02" $date }}">{{ $date | time.Format ":date_long" }}</time>
|
||||
{{ end }}
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
{{- if ge .ReadingTime 5 -}}
|
||||
|
||||
22
themes/42/layouts/taxonomies/taxonomies.html
Normal file
22
themes/42/layouts/taxonomies/taxonomies.html
Normal file
@@ -0,0 +1,22 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "hero-page.html" . }}
|
||||
<main>
|
||||
{{ with .Content }}
|
||||
<article class="article-body">
|
||||
{{ . }}
|
||||
</article>
|
||||
{{ end }}
|
||||
|
||||
{{ $ctx := . }}
|
||||
<ul class="keywords">
|
||||
{{- range $taxonomy, $terms := $ctx.Site.Taxonomies -}}
|
||||
{{ with $ctx.Site.GetPage $taxonomy }}
|
||||
<li>
|
||||
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
|
||||
<sub>{{ len $terms }}</sub>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</main>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user