use local scratch var in breadcrumbs

- fix undisplayed breadcrumbs in section pages
 having pagination
This commit is contained in:
Aditya Telange 2021-02-10 21:43:45 +05:30
parent 1a8e14a848
commit 034da04180
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
1 changed files with 3 additions and 2 deletions

View File

@ -4,10 +4,11 @@
{{- $lang_url := replace $url ( printf "%s" .Lang) "" }} {{- $lang_url := replace $url ( printf "%s" .Lang) "" }}
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a> <a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a>
{{- $scratch := newScratch }}
{{- range $index, $element := split $lang_url "/" }} {{- range $index, $element := split $lang_url "/" }}
{{- $.Scratch.Add "path" (printf "%s/" $element )}} {{- $scratch.Add "path" (printf "%s/" $element )}}
{{- $bc_pg := $.Site.GetPage ($.Scratch.Get "path") -}} {{- $bc_pg := $.Site.GetPage ($scratch.Get "path") -}}
{{- if (and ($bc_pg) (gt (len . ) 0))}} {{- if (and ($bc_pg) (gt (len . ) 0))}}
{{- print "&nbsp;»&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a> {{- print "&nbsp;»&nbsp;" | safeHTML -}}<a href="{{ $bc_pg.Permalink }}">{{ $bc_pg.Name }}</a>