mirror of
https://github.com/adityatelange/hugo-PaperMod.git
synced 2023-12-21 10:22:58 +01:00
breadcrumb nav as partial
This commit is contained in:
parent
65f84d6f19
commit
43ddff0fde
@ -2,24 +2,7 @@
|
|||||||
|
|
||||||
<article class="post-single">
|
<article class="post-single">
|
||||||
<header class="post-header">
|
<header class="post-header">
|
||||||
{{- if (.Param "ShowBreadCrumbs")}}
|
{{- partial "breadcrumbs.html" . }}
|
||||||
<div class="breadcrumbs">
|
|
||||||
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
|
|
||||||
{{- $lang_url := replace $url ( printf "%s" .Lang) "" }}
|
|
||||||
|
|
||||||
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a>
|
|
||||||
{{- 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 }}
|
|
||||||
|
|
||||||
{{- end }}
|
|
||||||
</div>
|
|
||||||
{{- end }}
|
|
||||||
<h1 class="post-title">
|
<h1 class="post-title">
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
{{- if .Draft }}<div class="entry-isdraft"><sup> [draft]</sup></div>{{- end }}
|
{{- if .Draft }}<div class="entry-isdraft"><sup> [draft]</sup></div>{{- end }}
|
||||||
|
18
layouts/partials/breadcrumbs.html
Normal file
18
layouts/partials/breadcrumbs.html
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{{- if (.Param "ShowBreadCrumbs")}}
|
||||||
|
<div class="breadcrumbs">
|
||||||
|
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
|
||||||
|
{{- $lang_url := replace $url ( printf "%s" .Lang) "" }}
|
||||||
|
|
||||||
|
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a>
|
||||||
|
{{- 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 }}
|
||||||
|
|
||||||
|
{{- end }}
|
||||||
|
</div>
|
||||||
|
{{- end }}
|
Loading…
Reference in New Issue
Block a user