istio.io/layouts/partials/header.html

105 lines
6.3 KiB
HTML

{{ $posts := (where .Site.Pages "Section" "blog").ByPublishDate.Reverse }}
{{ $latest_post := index $posts 0 }}
<header>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark justify-content-between">
{{ $home := .Site.GetPage "home" }}
<a class="navbar-brand" href="{{ $home.Permalink }}">
<span class="logo">{{ partial "icons/istio-logo-blue-background-round.svg" }}</span>
{{ if .Site.Data.args.archive }}
<span class="brand-name">Istioldie {{ .Site.Data.args.version }}</span>
{{ else if .Site.Data.args.preliminary }}
<span class="brand-name">Istio Prelim {{ .Site.Data.args.version }}</span>
{{ else }}
<span class="brand-name">Istio {{ .Site.Data.args.version }}</span>
{{ end }}
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
{{ $section := .Section }}
<div class="collapse navbar-collapse justify-content-end" id="navbarCollapse">
<ul id="navbar-links" class="navbar-nav active">
{{ with (.Site.GetPage "section" "docs") }}
<li class="nav-item">
<a class="nav-link {{ if eq $section "docs" }}active{{ end }}" title="{{ .Description }}" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</li>
{{ end }}
{{ with $latest_post }}
<li class="nav-item">
{{ $blog_home := .Site.GetPage "section" "blog" }}
<a class="nav-link {{ if eq $section "blog" }}active{{ end }}" title="{{ $blog_home.Description }}" href="{{ .Permalink }}">{{ $blog_home.LinkTitle }}</a>
</li>
{{ end }}
{{ with (.Site.GetPage "section" "help") }}
<li class="nav-item">
<a class="nav-link {{ if eq $section "help" }}active{{ end }}" title="{{ .Description }}" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</li>
{{ end }}
{{ with (.Site.GetPage "section" "about") }}
<li class="nav-item">
<a class="nav-link {{ if eq $section "about" }}active{{ end }}" title="{{ .Description }}" href="{{ .Permalink }}">{{ .LinkTitle }}</a>
</li>
{{ end }}
<li class="nav-item dropdown" id="gearDropdown" style="white-space: nowrap">
<a title='{{ i18n "options_menu" }}' href="" class="nav-link" data-toggle="dropdown" aria-label="Tools" aria-haspopup="true" aria-expanded="false">
<i style="width: 1em" class='fa fa-lg fa-cog'></i>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="gearDropdown">
<a class="dropdown-item" id="light-theme-item" href="" onclick="setActiveStyleSheet('light');return false;">{{ i18n "light_theme" }}</a>
<a class="dropdown-item" id="dark-theme-item" href="" onclick="setActiveStyleSheet('dark');return false;">{{ i18n "dark_theme" }}</a>
{{ if not .Site.Data.args.archive }}
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://github.com/istio/istio.github.io/issues/new?title=Issue%20with%20{{ .Path}}">{{ i18n "report_site_bugs" }}</a>
{{ if not .Params.generator }}
<a class="dropdown-item" href="https://github.com/istio/istio.github.io/edit/master/content/{{ .Path }}">{{ i18n "edit_on_github" }}</a>
{{ end }}
{{ end }}
<div class="dropdown-divider"></div>
<h6 class="dropdown-header">{{ i18n "other_versions_of_site" }}</h6>
{{ $next := index .Site.Data.releases 0 }}
{{ $current := index .Site.Data.releases 1 }}
{{ if .Site.Data.args.archive }}
<a href="https://istio.io" class="dropdown-item">{{ printf (i18n "current_release") $current.name }}</a>
<a href="https://preliminary.istio.io" class="dropdown-item">{{ printf (i18n "next_release") $next.name }}</a>
<a href="https://archive.istio.io" class="dropdown-item">{{ i18n "archived_releases" }}</a>
{{ else if .Site.Data.args.preliminary }}
<a href="https://istio.io" class="dropdown-item">{{ printf (i18n "current_release") $current.name }}</a>
<a href="https://archive.istio.io" class="dropdown-item">{{ i18n "archived_releases" }}</a>
{{ else }}
<a href="https://preliminary.istio.io" class="dropdown-item">{{ printf (i18n "next_release") $next.name }}</a>
<a href="https://archive.istio.io" class="dropdown-item">{{ i18n "archived_releases" }}</a>
{{ end }}
</div>
</li>
<li class="nav-item">
<a id="search_show" class="nav-link" href="" title='{{ i18n "search" }}' aria-label="Search"><i style="width: 1em" class="fa fa-lg fa-search"></i></a>
</li>
</ul>
<form name="cse" id="search_form" class="form-inline mr-sm-2" role="search">
<input type="hidden" name="cx" value="{{ .Site.Data.args.search_engine_id }}" />
<input type="hidden" name="ie" value="utf-8" />
<input type="hidden" name="hl" value="en" />
<input type="hidden" id="search_page_url" value="{{ .Site.BaseURL }}/search.html" />
<input id="search_textbox" class="form-control" name="q" type="text" aria-label="Search this site"/>
<button id="search_close" type="reset" aria-label="Cancel Search"><i class="far fa-lg fa-times-circle"></i></button>
</form>
</div>
</nav>
</header>