88 lines
2.9 KiB
HTML
88 lines
2.9 KiB
HTML
<!-- The Top Bar -->
|
|
<header id="topbar-wrapper" class="flex-shrink-0" aria-label="Top Bar">
|
|
<div id="topbar" class="d-flex align-items-center justify-content-between px-lg-3 h-100">
|
|
<nav id="breadcrumb" aria-label="Breadcrumb">
|
|
{{ $page := . }}
|
|
{{ $url := .RelPermalink }}
|
|
{{ $paths := split (trim $url "/") "/" }}
|
|
{{ $is_home := or (eq $url "/") (eq $url (relLangURL "/")) }}
|
|
|
|
{{ if $is_home }}
|
|
<!-- index page -->
|
|
<span>{{ T "tabs.home" | title }}</span>
|
|
{{else}}
|
|
<span>
|
|
<a href="{{ "/" | relLangURL }}">
|
|
{{- T "tabs.home" | title -}}
|
|
</a>
|
|
</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 := "" }}
|
|
{{ range site.Menus.main }}
|
|
{{ if eq .URL $page.RelPermalink }}
|
|
{{ $currentMenuEntry = . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
<!-- 显示逻辑 -->
|
|
{{ if $currentMenuEntry }}
|
|
<span>{{ $currentMenuEntry.Name }}</span>
|
|
{{ else }}
|
|
<span>{{ $page.Title }}</span> <!-- 使用保存的页面对象 -->
|
|
{{ end }}
|
|
|
|
|
|
{{ end }}
|
|
{{ end }}
|
|
</nav>
|
|
<!-- endof #breadcrumb -->
|
|
|
|
<button type="button" id="sidebar-trigger" class="btn btn-link" aria-label="Sidebar">
|
|
<i class="fas fa-bars fa-fw"></i>
|
|
</button>
|
|
|
|
<div id="topbar-title">
|
|
{{ if eq .Layout "home" }}
|
|
{{- .Site.Title -}}
|
|
{{ else if or (eq .Type "tabs") (eq .Kind "page") }}
|
|
{{- T (printf "tabs.%s" (path.Base $url)) | default .Title -}}
|
|
{{ else }}
|
|
{{- T (printf "layout.%s" .Layout) | default (.Layout | title) -}}
|
|
{{ end }}
|
|
</div>
|
|
|
|
<button type="button" id="search-trigger" class="btn btn-link" aria-label="Search">
|
|
<i class="fas fa-search fa-fw"></i>
|
|
</button>
|
|
|
|
<search id="search" class="align-items-center ms-3 ms-lg-0">
|
|
<i class="fas fa-search fa-fw"></i>
|
|
<input
|
|
class="form-control"
|
|
id="search-input"
|
|
type="search"
|
|
aria-label="search"
|
|
autocomplete="off"
|
|
placeholder="{{ T "search.hint" | title }}..."
|
|
>
|
|
</search>
|
|
<button type="button" class="btn btn-link text-decoration-none" id="search-cancel">
|
|
{{- T "search.cancel" -}}
|
|
</button>
|
|
</div>
|
|
</header> |