From 0f0e027def4bce325f810be4c9f4e3c3a9218b68 Mon Sep 17 00:00:00 2001
From: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
Date: Sun, 28 Mar 2021 19:23:53 +0530
Subject: [PATCH] Remove trailing and leading slashes off the $url for
Breadcrumb gen; so that no empty values remain in []interface
fixes: #331
---
layouts/partials/breadcrumbs.html | 1 +
layouts/partials/templates/schema_json.html | 1 +
2 files changed, 2 insertions(+)
diff --git a/layouts/partials/breadcrumbs.html b/layouts/partials/breadcrumbs.html
index 0ffbc095..bf1f4b22 100644
--- a/layouts/partials/breadcrumbs.html
+++ b/layouts/partials/breadcrumbs.html
@@ -1,6 +1,7 @@
{{- if (.Param "ShowBreadCrumbs")}}
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
+ {{- $url = (trim $url "/" ) }}
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
{{ i18n "home" | default "Home"}}
diff --git a/layouts/partials/templates/schema_json.html b/layouts/partials/templates/schema_json.html
index 6e0a289c..df11065d 100644
--- a/layouts/partials/templates/schema_json.html
+++ b/layouts/partials/templates/schema_json.html
@@ -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 "/")}}