This repository has been archived on 2025-08-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
hugo-mistergeek/layouts/partials/breadcrumb.html

70 lines
2.7 KiB
HTML

<!-- Breadcrumb Navigation with SEO optimization -->
<div class="breadcrumb-wrapper">
<div class="container">
<div class="row">
<div class="col-12">
<nav aria-label="breadcrumb">
<ol class="breadcrumb" itemscope itemtype="https://schema.org/BreadcrumbList">
<!-- Home/Accueil with SEO -->
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="{{ "/" | relLangURL }}" itemprop="item" title="{{ i18n "home" | default "Accueil" }}">
<span itemprop="name">{{ i18n "home" | default "Accueil" }}</span>
</a>
<meta itemprop="position" content="1" />
</li>
<!-- Category with SEO and linking -->
{{ if or .Params.categories .Section }}
{{ $category := "" }}
{{ $categorySlug := "" }}
{{ $categoryUrl := "" }}
{{ if .Params.categories }}
{{ $category = index .Params.categories 0 }}
{{ $categorySlug = urlize $category }}
{{ $categoryUrl = printf "/categories/%s" $categorySlug }}
{{ else if .Section }}
{{ $category = humanize .Section }}
{{ $categorySlug = .Section }}
{{ $categoryUrl = printf "/%s" .Section }}
{{ end }}
{{ if $category }}
<li class="breadcrumb-item active" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" aria-current="page">
<a href="{{ $categoryUrl | relLangURL }}" itemprop="item" title="{{ $category }}">
<span itemprop="name">{{ $category }}</span>
</a>
<meta itemprop="position" content="2" />
</li>
{{ end }}
{{ end }}
</ol>
</nav>
</div>
</div>
</div>
</div>
<!-- JSON-LD Structured Data for SEO -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "{{ i18n "home" | default "Accueil" }}",
"item": "{{ "/" | absLangURL }}"
}{{ if or .Params.categories .Section }},
{
"@type": "ListItem",
"position": 2,
"name": "{{ if .Params.categories }}{{ index .Params.categories 0 }}{{ else }}{{ humanize .Section }}{{ end }}",
"item": "{{ if .Params.categories }}{{ printf "%s/categories/%s" (absLangURL "") (urlize (index .Params.categories 0)) }}{{ else }}{{ printf "%s/%s" (absLangURL "") .Section }}{{ end }}"
}{{ end }}
]
}
</script>