mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2026-05-21 11:05:49 +00:00
style(breadcrumbs): update markup to use <nav> for improved semantics and add SVG seperator
This commit is contained in:
@@ -23,6 +23,15 @@
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0.2rem;
|
||||
}
|
||||
|
||||
.breadcrumbs a {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.breadcrumbs svg {
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
.i18n_list {
|
||||
@@ -34,10 +43,6 @@
|
||||
margin: auto 3px;
|
||||
}
|
||||
|
||||
.breadcrumbs a {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.post-meta .i18n_list li a,
|
||||
.toc a:hover {
|
||||
box-shadow: 0 1px 0;
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
{{- if (.Param "ShowBreadCrumbs") -}}
|
||||
<div class="breadcrumbs">
|
||||
<nav class="breadcrumbs" role="navigation" aria-label="Breadcrumb">
|
||||
<a href='{{ "" | absLangURL }}'>
|
||||
{{- i18n "home" | default "Home" -}}
|
||||
</a>
|
||||
{{- $url := replace .Parent.Permalink (printf "%s" site.Home.Permalink) "" }}
|
||||
{{- $lang_url := strings.TrimPrefix (printf "%s/" .Lang) $url -}}
|
||||
|
||||
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home" }}</a>
|
||||
{{- $scratch := newScratch }}
|
||||
{{- range $index, $element := split $lang_url "/" }}
|
||||
|
||||
{{- $scratch.Add "path" (printf "%s/" $element )}}
|
||||
{{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
|
||||
|
||||
{{- if (and ($bc_pg) (gt (len . ) 0))}}
|
||||
{{- print " » " | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a>
|
||||
{{- end }}
|
||||
|
||||
{{- $scratch.Add "path" (printf "%s/" $element )}}
|
||||
{{- $bc_pg := site.GetPage ($scratch.Get "path") -}}
|
||||
{{- if (and ($bc_pg) (gt (len . ) 0))}}
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-right">
|
||||
<polyline points="9 18 15 12 9 6"></polyline>
|
||||
</svg>
|
||||
<a href="{{ $bc_pg.Permalink }}">
|
||||
{{- $bc_pg.Name -}}
|
||||
</a>
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
</div>
|
||||
</nav>
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user