theme: switch from data-vocabulary to schema #84

This commit is contained in:
Sören Weber 2021-09-10 00:18:57 +02:00
parent 2775489287
commit f65bacd4cd
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 42 additions and 15 deletions

View file

@ -4,7 +4,7 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ hugo.Generator -}} {{ hugo.Generator -}}
{{- partial "meta.html" . }} {{ partial "meta.html" . }}
{{ partial "favicon.html" . }} {{ partial "favicon.html" . }}
<title>{{ .Title }} {{ default "::" .Site.Params.titleSeparator }} {{ .Site.Title }}</title> <title>{{ .Title }} {{ default "::" .Site.Params.titleSeparator }} {{ .Site.Title }}</title>
@ -59,24 +59,27 @@
{{ end }} {{ end }}
{{ end }} {{ end }}
{{$toc := (and (not .Params.disableToc) (not .Params.chapter))}} {{$toc := (and (not .Params.disableToc) (not .Params.chapter))}}
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"> <div id="breadcrumbs">
<span id="sidebar-toggle-span"> <span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle=""> <a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fas fa-bars"></i> <i class="fas fa-bars"></i>
</a> </a>
</span> </span>
{{ if $toc }} {{ if $toc }}
<span id="toc-menu"><i class="fas fa-list-alt"></i></span> <span id="toc-menu"><i class="fas fa-list-alt"></i></span>
{{ end }} {{ end }}
<span class="links"> {{$showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb))}}
{{$showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb))}} {{if $showBreadcrumb}}
{{if $showBreadcrumb}} <ol class="links" itemscope itemtype="http://schema.org/BreadcrumbList">
{{ template "breadcrumb" dict "page" . "value" .Title }} <meta itemprop="itemListOrder" content="Descending" />
{{ else }} {{ template "breadcrumb" dict "page" . "depth" 0 }}
{{ .Title }} </ol>
{{ end }} {{ else }}
</span> <span class="links">
</div> {{ .Title }}
</span>
{{ end }}
</div>
{{ if $toc }} {{ if $toc }}
{{ partial "toc.html" . }} {{ partial "toc.html" . }}
{{ end }} {{ end }}
@ -101,10 +104,23 @@
{{define "breadcrumb"}} {{define "breadcrumb"}}
{{$parent := .page.Parent }} {{$parent := .page.Parent }}
{{$depth := add .depth 1 }}
{{ if $parent }} {{ if $parent }}
{{ $value := (printf "<a href='%s'>%s</a> > %s" $parent.RelPermalink $parent.Title .value) }} {{ template "breadcrumb" dict "page" $parent "depth" $depth }}
{{ template "breadcrumb" dict "page" $parent "value" $value }} {{end}}
{{ if .depth }}
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
<meta itemprop="position" content="{{ $depth }}" />
<a itemprop="item" href="{{ .page.RelPermalink }}">
<span itemprop="name">{{ .page.Title }}</span>
</a>
</li> >
{{else}} {{else}}
{{.value|safeHTML}} <li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">
<meta itemprop="position" content="{{ $depth }}" />
<span itemprop="item">
<span itemprop="name">{{ .page.Title }}</span>
</span>
</li>
{{end}} {{end}}
{{end}} {{end}}

View file

@ -1004,6 +1004,17 @@ td {
#body #breadcrumbs span { #body #breadcrumbs span {
padding: 0 0.1rem; padding: 0 0.1rem;
} }
#body #breadcrumbs .links {
display: inline;
padding: 0 0.1rem;
}
#body #breadcrumbs .links * {
display: inline-block;
padding: 0;
}
#body #breadcrumbs .links meta {
display: none;
}
@media only all and (max-width: 59.938em) { @media only all and (max-width: 59.938em) {
#sidebar { #sidebar {
width: 230px; width: 230px;