Skip to content

Commit 8a1270e

Browse files
committed
enforce language url subsitution on path boundary
Without this, the section name gets mangled when the language was a substring of the section. For example, under 'en', a section named "fragment" changes to "fragmt".
1 parent e53bfe5 commit 8a1270e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

layouts/partials/breadcrumbs.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{- if (.Param "ShowBreadCrumbs")}}
22
<div class="breadcrumbs">
33
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
4-
{{- $lang_url := replace $url ( printf "%s" .Lang) "" }}
4+
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
55

66
<a href="{{ "" | absLangURL }}">{{ i18n "home" | default "Home"}}</a>
77
{{- $scratch := newScratch }}

layouts/partials/templates/schema_json.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{{- else if (or .IsPage .IsSection) }}
2020
{{/* BreadcrumbList */}}
2121
{{- $url := replace .Parent.Permalink ( printf "%s" .Site.BaseURL) "" }}
22-
{{- $lang_url := replace $url ( printf "%s" .Lang) "" }}
22+
{{- $lang_url := strings.TrimPrefix ( printf "%s/" .Lang) $url }}
2323
{{- $bc_list := (split $lang_url "/")}}
2424

2525
{{- $scratch := newScratch }}

0 commit comments

Comments
 (0)