mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-11 14:20:23 -04:00
Adjust logic to mark current section for Algolia
This commit is contained in:
parent
ba73ce646b
commit
769e387cd4
@ -3,8 +3,10 @@
|
||||
|
||||
<nav aria-label="breadcrumb" class="flex breadcrumbs">
|
||||
<ol class="inline-flex items-center flex-wrap tracking-tight">
|
||||
{{ $currentSection := .CurrentSection }}
|
||||
{{ $ancestors := .Ancestors.Reverse }}
|
||||
{{ range $i, $p := $ancestors }}
|
||||
{{ $isCurrentSection := eq $p $currentSection }}
|
||||
{{/* We currently have a slightly odd structure. */}}
|
||||
{{ if eq $p site.Home }}
|
||||
{{ $p = $documentation }}
|
||||
@ -13,7 +15,7 @@
|
||||
{{ $isLast := eq $i (sub (len $ancestors) 1) }}
|
||||
<a
|
||||
href="{{ $p.RelPermalink }}"
|
||||
class="truncate text-blue-600 hover:text-blue-500 {{ if $isLast }}
|
||||
class="truncate text-blue-600 hover:text-blue-500 {{ if $isCurrentSection }}
|
||||
current-section
|
||||
{{ end }}"
|
||||
>{{ $p.LinkTitle }}</a
|
||||
@ -24,7 +26,11 @@
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if ne $ $documentation }}
|
||||
<li class="truncate text-gray-700 dark:text-gray-300">
|
||||
{{ $isCurrentSection := eq $ $currentSection }}
|
||||
<li
|
||||
class="truncate text-gray-700 dark:text-gray-300 {{ if $isCurrentSection }}
|
||||
current-section
|
||||
{{ end }}">
|
||||
{{ $.LinkTitle }}
|
||||
</li>
|
||||
{{ end }}
|
||||
|
Loading…
x
Reference in New Issue
Block a user