Taxonomies
This commit is contained in:
@@ -1,19 +1,39 @@
|
||||
{{- $page := . -}}
|
||||
{{- with .Page -}}
|
||||
{{- $page = . -}}
|
||||
{{- end -}}
|
||||
{{- if or $page.IsPage $page.IsSection -}}
|
||||
{{- $trail := slice -}}
|
||||
{{- with .Page }}{{ $page = . }}{{ end -}}
|
||||
{{- $trail := slice -}}
|
||||
{{- if $page }}
|
||||
{{- range $page.Ancestors.Reverse -}}
|
||||
{{- if ne .RelPermalink "/" -}}
|
||||
{{- $trail = $trail | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if gt (len $trail) 0 -}}
|
||||
<nav class="breadcrumbs" aria-label="Fil d’Ariane">
|
||||
{{- range $item := $trail -}}
|
||||
<a href="{{ $item.RelPermalink }}">{{ with $item.LinkTitle }}{{ . }}{{ else }}{{ $item.Title }}{{ end }}</a>
|
||||
|
||||
{{- if eq $page.Kind "term" }}
|
||||
{{- with site.GetPage "taxonomy" $page.Data.Plural }}
|
||||
{{- 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 -}}
|
||||
</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 d’Ariane">
|
||||
{{- range $item := $trail -}}
|
||||
<a href="{{ $item.RelPermalink }}">{{ with $item.LinkTitle }}{{ . }}{{ else }}{{ $item.Title }}{{ end }}</a>
|
||||
{{- end -}}
|
||||
</nav>
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<header id="hero-page" class="panel-hero">
|
||||
<header id="hero-page" class="panel panel-hero">
|
||||
{{ partialCached "site-title.html" . }}
|
||||
<div class="page-meta">
|
||||
{{ partial "breadcrumbs.html" . }}
|
||||
|
||||
13
themes/42/layouts/_partials/keywords.html
Normal file
13
themes/42/layouts/_partials/keywords.html
Normal 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 }}
|
||||
@@ -25,6 +25,8 @@
|
||||
{{ end }}
|
||||
|
||||
{{ .Content }}
|
||||
|
||||
{{- partial "asides/keywords.html" . }}
|
||||
</article>
|
||||
</main>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ partial "hero-section.html" . }}
|
||||
<main>
|
||||
{{ .Content }}
|
||||
{{ range .Pages }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
|
||||
{{- with .Pages }}
|
||||
{{- partial "keywords.html" (.ByTitle) }}
|
||||
{{- end }}
|
||||
</main>
|
||||
{{ end }}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
{{ partial "hero-section.html" . }}
|
||||
<main>
|
||||
{{ .Content }}
|
||||
{{ range .Pages }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{- partial "articles-list.html" (dict "Pages" .Pages.ByDate.Reverse "Context" .) -}}
|
||||
</main>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user