From bb68b7b28a9c2e58dc1d04f43d275b441355ffae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Thu, 21 Sep 2023 00:26:42 +0200 Subject: [PATCH] breadcrumb: remove superflous whitespace between items #643 --- layouts/partials/header.html | 11 +++++++---- static/css/theme.css | 21 ++++++++++----------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/layouts/partials/header.html b/layouts/partials/header.html index d12b9e2ba3..90c78c0182 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -76,7 +76,7 @@ {{- $showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb)) }} {{- if $showBreadcrumb }} -
    + {{- else }} @@ -96,6 +96,7 @@ {{- define "breadcrumb" }} {{- $breadcrumb := slice }} {{- $page := .page }} + {{- $pageurl := partial "relLangPrettyUglyURL.hugo" (dict "to" $page) }} {{- $to := .to }} {{- $breadcrumb = $breadcrumb | append $to }} {{- $depth := int (partial "get-page-depth.hugo" (dict "page" $page)) }} @@ -112,12 +113,10 @@ {{- range seq $len }} {{- $breadcrumbReversed = $breadcrumbReversed | append (index $breadcrumb (sub $len .)) }} {{- end }} - {{- $remaining := $len }} {{- $depth := 0 }} {{- range $i, $e := $breadcrumbReversed }} {{- $to := $e }} {{- $ispublished := gt (int (len $to.Permalink)) 0 }} - {{- $remaining = sub $remaining 1 }} {{- if $ispublished }} {{- $depth = add $depth 1 }} {{- $title := $to.Title }} @@ -136,7 +135,11 @@ {{- if not $title }} {{- $title = $to.Site.Title }} {{- end }} -
  1. {{ if $remaining }}{{end}}{{ $title }}{{ if $remaining }}{{ end }}{{ if $remaining }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }}
  2. + {{- $url := partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }} + {{- $last := eq $url $pageurl }} + {{- $link := and $url (not $last) }} + {{- printf "{{ if $link }}{{end}}{{ $title }}{{ if $link }}{{ end }}{{ if not $last }}{{ (printf " %s " (default ">" .Site.Params.breadcrumbSeparator)) | safeHTML }}{{ end }} {{- end }} {{- end }} {{- end }} \ No newline at end of file diff --git a/static/css/theme.css b/static/css/theme.css index 56d283198a..b781a7955c 100644 --- a/static/css/theme.css +++ b/static/css/theme.css @@ -1065,12 +1065,7 @@ html[dir="rtl"] .topbar-button-next i { flex-grow: 1; line-height: 1.2; margin: 0; - min-width: 0; - overflow: hidden; padding: 0 1rem; - text-overflow: ellipsis; - width: 100%; - white-space: nowrap; } @media screen and (max-width: 48rem) { .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; } -.topbar-breadcrumbs li { +.breadcrumbs li { display: inline-block; } -.topbar-breadcrumbs li:last-of-type { - cursor: text; -} - #body a[aria-disabled="true"] { pointer-events: none; text-decoration: none;