update topbar

This commit is contained in:
geekifan
2025-04-23 11:31:00 +08:00
parent 775ea0489d
commit 69035f8d09

View File

@ -5,18 +5,32 @@
{{ $page := . }} {{ $page := . }}
{{ $url := .RelPermalink }} {{ $url := .RelPermalink }}
{{ $paths := split (trim $url "/") "/" }} {{ $paths := split (trim $url "/") "/" }}
{{ $is_home := or (eq $url "/") (eq $url (relLangURL "/")) }}
{{ if or (eq $url "/") (eq $url (relLangURL "/")) }} {{ if $is_home }}
<!-- index page --> <!-- index page -->
<span>{{ T "tabs.home" | title }}</span> <span>{{ T "tabs.home" | title }}</span>
{{else}} {{else}}
{{ range $index, $item := $paths }}
{{ if eq $index 0 }}
<span> <span>
<a href="{{ "/" | relLangURL }}"> <a href="{{ "/" | relLangURL }}">
{{- T "tabs.home" | title -}} {{- T "tabs.home" | title -}}
</a> </a>
</span> </span>
{{ if eq $page.Type "tags" }}
{{ if .Data.Term}}
<span><a href="{{ "/tags/" | relLangURL }}">{{i18n "tabs.tags"}}</a></span>
<span>{{ .Data.Term }}</span>
{{ else }}
<span>{{i18n "tabs.tags"}}</span>
{{ end }}
{{ else if eq $page.Type "categories" }}
{{ if .Data.Term}}
<span><a href="{{ "/categories/" | relLangURL }}">{{i18n "tabs.categories"}}</a></span>
<span>{{ .Data.Term }}</span>
{{ else }}
<span>{{i18n "tabs.categories"}}</span>
{{ end }}
{{ else }}
{{ $currentMenuEntry := "" }} {{ $currentMenuEntry := "" }}
{{ range site.Menus.main }} {{ range site.Menus.main }}
@ -33,7 +47,6 @@
{{ end }} {{ end }}
{{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
</nav> </nav>