mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
breadcrumb: remove superflous whitespace between items #643
This commit is contained in:
parent
84cd619b69
commit
bb68b7b28a
2 changed files with 17 additions and 15 deletions
|
@ -76,7 +76,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
|
{{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }}
|
||||||
{{- if $showBreadcrumb }}
|
{{- if $showBreadcrumb }}
|
||||||
<ol class="topbar-breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
|
<ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList">
|
||||||
{{- template "breadcrumb" dict "page" . "to" . }}
|
{{- template "breadcrumb" dict "page" . "to" . }}
|
||||||
</ol>
|
</ol>
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
@ -96,6 +96,7 @@
|
||||||
{{- define "breadcrumb" }}
|
{{- define "breadcrumb" }}
|
||||||
{{- $breadcrumb := slice }}
|
{{- $breadcrumb := slice }}
|
||||||
{{- $page := .page }}
|
{{- $page := .page }}
|
||||||
|
{{- $pageurl := partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }}
|
||||||
{{- $to := .to }}
|
{{- $to := .to }}
|
||||||
{{- $breadcrumb = $breadcrumb | append $to }}
|
{{- $breadcrumb = $breadcrumb | append $to }}
|
||||||
{{- $depth := int (partial "get-page-depth.hugo" (dict "page" $page)) }}
|
{{- $depth := int (partial "get-page-depth.hugo" (dict "page" $page)) }}
|
||||||
|
@ -112,12 +113,10 @@
|
||||||
{{- range seq $len }}
|
{{- range seq $len }}
|
||||||
{{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }}
|
{{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $remaining := $len }}
|
|
||||||
{{- $depth := 0 }}
|
{{- $depth := 0 }}
|
||||||
{{- range $i, $e := $breadcrumbReversed }}
|
{{- range $i, $e := $breadcrumbReversed }}
|
||||||
{{- $to := $e }}
|
{{- $to := $e }}
|
||||||
{{- $ispublished := gt (int (len $to.Permalink)) 0 }}
|
{{- $ispublished := gt (int (len $to.Permalink)) 0 }}
|
||||||
{{- $remaining = sub $remaining 1 }}
|
|
||||||
{{- if $ispublished }}
|
{{- if $ispublished }}
|
||||||
{{- $depth = add $depth 1 }}
|
{{- $depth = add $depth 1 }}
|
||||||
{{- $title := $to.Title }}
|
{{- $title := $to.Title }}
|
||||||
|
@ -136,7 +135,11 @@
|
||||||
{{- if not $title }}
|
{{- if not $title }}
|
||||||
{{- $title = $to.Site.Title }}
|
{{- $title = $to.Site.Title }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $remaining }}<a itemprop="item" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $remaining }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if $remaining }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
|
{{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}
|
||||||
|
{{- $last := eq $url $pageurl }}
|
||||||
|
{{- $link := and $url (not $last) }}
|
||||||
|
{{- printf "<li" | safeHTML }}
|
||||||
|
itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement">{{ if $link }}<a itemprop="item" href="{{ $url }}">{{end}}<span itemprop="name">{{ $title }}</span>{{ if $link }}</a>{{ end }}<meta itemprop="position" content="{{ $depth }}">{{ if not $last }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}</li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
|
@ -1065,12 +1065,7 @@ html[dir="rtl"] .topbar-button-next i {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
min-width: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
text-overflow: ellipsis;
|
|
||||||
width: 100%;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
}
|
||||||
@media screen and (max-width: 48rem) {
|
@media screen and (max-width: 48rem) {
|
||||||
.topbar-breadcrumbs {
|
.topbar-breadcrumbs {
|
||||||
|
@ -1081,18 +1076,22 @@ html[dir="rtl"] .topbar-button-next i {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbar-breadcrumbs meta {
|
.breadcrumbs {
|
||||||
|
min-width: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
width: 100%;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.breadcrumbs meta {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbar-breadcrumbs li {
|
.breadcrumbs li {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbar-breadcrumbs li:last-of-type {
|
|
||||||
cursor: text;
|
|
||||||
}
|
|
||||||
|
|
||||||
#body a[aria-disabled="true"] {
|
#body a[aria-disabled="true"] {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
Loading…
Reference in a new issue