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
2025-08-20 11:21:40 +02:00

78 lines
2.9 KiB
HTML

<!-- Modern Breadcrumb Navigation -->
<nav class="breadcrumb-nav" aria-label="breadcrumb">
<div class="breadcrumb-container">
<ol class="breadcrumb-list" itemscope itemtype="https://schema.org/BreadcrumbList">
<!-- Home -->
<li class="breadcrumb-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="{{ "/" | relLangURL }}" itemprop="item" title="{{ i18n "home" | default "Home" }}">
<i class="fas fa-home" aria-hidden="true"></i>
<span itemprop="name">{{ i18n "home" | default "Accueil" }}</span>
</a>
<meta itemprop="position" content="1" />
</li>
<!-- Category -->
{{ if or .Params.categories .Section }}
{{ $category := "" }}
{{ $categorySlug := "" }}
{{ $categoryUrl := "" }}
{{ if .Params.categories }}
{{ $category = index .Params.categories 0 }}
{{ $categorySlug = anchorize $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" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
<a href="{{ $categoryUrl | relLangURL }}" itemprop="item" title="{{ $category }}">
<span itemprop="name">{{ $category }}</span>
</a>
<meta itemprop="position" content="2" />
</li>
{{ end }}
{{ end }}
<!-- Current Page -->
<li class="breadcrumb-item active" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem" aria-current="page">
<span itemprop="name">{{ .Title }}</span>
<meta itemprop="position" content="{{ if or .Params.categories .Section }}3{{ else }}2{{ end }}" />
</li>
</ol>
</div>
</nav>
<!-- JSON-LD Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "{{ i18n "home" | default "Home" }}",
"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 "") (anchorize (index .Params.categories 0)) }}{{ else }}{{ printf "%s/%s" (absLangURL "") .Section }}{{ end }}"
}{{ end }},
{
"@type": "ListItem",
"position": {{ if or .Params.categories .Section }}3{{ else }}2{{ end }},
"name": "{{ .Title }}",
"item": "{{ .Permalink }}"
}
]
}
</script>