Breadcrumbs Uppercase letter

I found this code snipped Breadcrum with branch section support

It works fine, but there is a small mistake. Please take a look at the screenshot The third link has a lowercase letter. I would like to have an Uppercase letter.

content/company/brand-guidelines.md

---
title: "brand-guidelines"
description: "Brand guidelines"
draft: false
---

i18n

{
"Brand guidelines": "Brand guidelines"
}

partials/breadcrumbs.html

<nav class="" aria-label="breadcrumb ">
	<ol class="breadcrumb">
		<li class="breadcrumb-item"><a href="/">{{i18n "Home" }}</a></li>
		{{ $lastUrlElement := index (last 1 (split (delimit (split .RelPermalink "/") "," "") ",")) 0 }}
		{{- $.Scratch.Set "url" "" -}}
		{{- range (split .RelPermalink "/") -}}
		{{- if (gt (len .) 0) -}}
		{{- $.Scratch.Set "isSection" "false" -}}
		{{- $.Scratch.Set "isPage" "false" -}}
		{{- $.Scratch.Add "url" (print "/" . ) -}}
		{{- if $.Site.GetPage (print . ".md") -}}
		{{- with $.Site.GetPage (print . ".md") -}}
		{{- if .IsPage -}}
		{{- $.Scratch.Set "isPage" "true" -}}
		{{- end -}}
		{{- end -}}
		{{- end -}}
		{{- if eq ($.Scratch.Get "isPage") "true" -}}
		{{- with $.Site.GetPage (print . ".md") -}}
		<li class="breadcrumb-item active" aria-current="page"><a href="{{ $.Scratch.Get `url` }}">
				{{ if (eq (i18n .Title) "" ) }} {{ .Title }}{{ else }}{{ i18n .Title }}{{ end }}</a></li>
		{{- end -}}
		{{- else -}}
		{{- if eq $lastUrlElement . -}}
		<li class="breadcrumb-item active"><a href="{{ $.Scratch.Get `url` }}">{{ if (eq (i18n (humanize . )) "" ) }} {{
				humanize .}}{{ else }}{{ i18n (humanize . ) }}{{ end }}</a></li>
		{{- else -}}
		<li class="breadcrumb-item"><a href="{{ $.Scratch.Get `url` }}">{{ if (eq (i18n (humanize . )) "" ) }} {{ humanize
				.}}{{ else }}{{ i18n (humanize . ) }}{{ end }}</a></li>
		{{- end -}}
		{{- end -}}
		{{- end -}}
		{{- end -}}
	</ol>
</nav>

img

The solution is:

---
title: "Brand-guidelines"
description: "Brand guidelines"
draft: false
---

Try the ancestors method to generate breadcrumbs Sections | Hugo

Thank you for this tip.

I think the proper solution would be to run your .Title’s through string.Title to have them use title case.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.