Remove trailing and leading slashes off the $url for Breadcrumb gen;

so that no empty values remain in []interface

fixes: #331
This commit is contained in:
Aditya Telange 2021-03-28 19:23:53 +05:30
parent fb4988cfb6
commit 0f0e027def
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
2 changed files with 2 additions and 0 deletions

View File

@ -1,6 +1,7 @@
{{- if (.Param "ShowBreadCrumbs")}}
<div class="breadcrumbs">
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
{{- $url = (trim $url "/" ) }}
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a>

View File

@ -19,6 +19,7 @@
{{- else if (or .IsPage .IsSection) }}
{{/* BreadcrumbList */}}
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
{{- $url = (trim $url "/" ) }}
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
{{- $bc_list := (split $lang_url "/")}}