matrix-spec/layouts/_partials/navbar.html
Kévin Commaille c47fa4d093
Some checks are pending
Spec / 🔎 Validate OpenAPI specifications (push) Waiting to run
Spec / 🔎 Check Event schema examples (push) Waiting to run
Spec / 🔎 Check OpenAPI definitions examples (push) Waiting to run
Spec / 🔎 Check JSON Schemas inline examples (push) Waiting to run
Spec / ⚙️ Calculate baseURL for later jobs (push) Waiting to run
Spec / 🐍 Build OpenAPI definitions (push) Blocked by required conditions
Spec / 📢 Run towncrier for changelog (push) Waiting to run
Spec / 📖 Build the spec (push) Blocked by required conditions
Spec / 🔎 Validate generated HTML (push) Blocked by required conditions
Spec / 📖 Build the historical backup spec (push) Blocked by required conditions
Spec / Create release (push) Blocked by required conditions
Spell Check / Spell Check with Typos (push) Waiting to run
Bump docsy to v0.13.0 (#2287)
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2026-01-15 17:01:07 +00:00

103 lines
3.4 KiB
HTML

{{- /*
A copy of the navbar.html partial in Docsy, modified to:
* remove `data-bs-theme` at L20, otherwise the title disappears on hover.
* replace the site title with "specification" at L31.
* include the spec version from the config at L34-35, which is calculated
using an inline `version-string` partial.
*/ -}}
{{ $cover := and
(.HasShortcode "blocks/cover")
(not .Site.Params.ui.navbar_translucent_over_cover_disable)
-}}
{{ $baseURL := urls.Parse $.Site.Params.Baseurl -}}
<nav class="td-navbar js-navbar-scroll
{{- if $cover }} td-navbar-cover {{- end }}">
<div class="td-navbar-container container-fluid flex-column flex-md-row">
<a class="navbar-brand" href="{{ .Site.Home.RelPermalink }}">
{{- /**/ -}}
<span class="navbar-brand__logo navbar-logo">
{{- if ne .Site.Params.ui.navbar_logo false -}}
{{ with resources.Get "icons/logo.svg" -}}
{{ ( . | minify).Content | safeHTML -}}
{{ end -}}
{{ end -}}
</span>
{{- /**/ -}}
<span class="navbar-brand__name">
specification
</span>
{{- /**/ -}}
<span class="navbar-version"> &mdash; {{ partial "version-string" . }}</span>
{{- /**/ -}}
</a>
<div class="td-navbar-nav-scroll td-navbar-nav-scroll--indicator" id="main_navbar">
<div class="scroll-indicator scroll-left"></div>
<ul class="navbar-nav">
{{ $p := . -}}
{{ range .Site.Menus.main -}}
<li class="nav-item">
{{ $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) -}}
{{ $href := "" -}}
{{ with .Page -}}
{{ $active = or $active ( $.IsDescendant .) -}}
{{ $href = .RelPermalink -}}
{{ else -}}
{{ $href = .URL | relLangURL -}}
{{ end -}}
{{ $isExternal := ne $baseURL.Host (urls.Parse .URL).Host -}}
<a {{/**/ -}}
class="nav-link {{- if $active }} active {{- end }}" {{/**/ -}}
href="{{ $href }}"
{{- if $isExternal }} target="_blank" rel="noopener" {{- end -}}
>
{{- .Pre -}}
<span>{{ .Name }}</span>
{{- .Post -}}
</a>
</li>
{{ end -}}
{{ if .Site.Params.versions -}}
<li class="nav-item dropdown d-none d-lg-block td-navbar__version-menu">
{{ partial "navbar-version-selector.html" . -}}
</li>
{{ end -}}
{{ if (gt (len .Site.Home.Translations) 0) -}}
<li class="nav-item td-navbar__lang-menu">
{{ partial "navbar-lang-selector.html" . -}}
</li>
{{ end -}}
{{- $darkMode := partialCached "dark-mode-config.html" "dark-mode-global" -}}
{{ if $darkMode.showMenu -}}
<li class="nav-item td-navbar__light-dark-menu">
{{ partial "theme-toggler" . }}
</li>
{{ end -}}
</ul>
<div class="scroll-indicator scroll-right"></div>
</div>
<div class="d-none d-lg-block td-navbar__search">
{{ partial "search-input.html" . }}
</div>
</div>
</nav>
{{- define "_partials/version-string" -}}
{{ $ret := "unstable version" -}}
{{ $status := .Site.Params.version.status -}}
{{ if ne $status "unstable" -}}
{{ $path := path.Join "changelogs" -}}
{{/* produces a string similar to "version v1.5" */ -}}
{{ $ret = delimit (slice "version v" .Site.Params.version.major "." .Site.Params.version.minor) "" -}}
{{ end -}}
{{ return $ret -}}
{{- end -}}