hugo-theme-introduction/layouts/partials/nav.html

73 lines
2.8 KiB
HTML
Raw Normal View History

2018-06-11 23:39:40 +00:00
<!-- Begin Nav bar -->
<div class="container">
2018-06-27 08:58:30 +00:00
<hr>
<nav class="nav nav-center">
{{ $isHome := .Page.IsHome }}
2018-07-01 08:09:29 +00:00
{{/* if not $isHome */}}
2018-06-27 08:58:30 +00:00
<span id="nav-toggle" class="nav-toggle" onclick="document.getElementById('nav-menu').classList.toggle('is-active');">
<span></span>
<span></span>
<span></span>
</span>
<div id="nav-menu" class="nav-left nav-menu">
2018-07-01 08:09:29 +00:00
{{/* end */}}
2018-06-27 08:58:30 +00:00
{{ if not $isHome }}
<a class="nav-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a>
{{ end }}
{{ with .Site.GetPage "page" "about" }}
2018-07-01 08:09:29 +00:00
<a class="nav-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a>
2018-06-27 08:58:30 +00:00
{{ end }}
2018-06-11 23:39:40 +00:00
2018-06-27 08:58:30 +00:00
{{ $pageIsInProjects := eq .Page.Section "projects"}}
{{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }}
{{ with .Site.GetPage "section" "projects" }}
{{ if $isHome }}
2018-06-27 09:30:11 +00:00
<a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
2018-06-27 08:58:30 +00:00
{{ else }}
<a class="nav-item" href="{{ .RelPermalink }}">
{{ if $pageIsInProjects }}
{{ i18n "nav_backToSection" . }}
{{ else }}
{{ .Title }}
{{ end }}
</a>
{{ end }}
{{ end }}
{{ end }}
2018-06-11 23:39:40 +00:00
2018-06-27 08:58:30 +00:00
{{ $pageIsInBlog := eq .Page.Section "blog"}}
{{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }}
{{ with .Site.GetPage "section" "blog" }}
{{ if $isHome }}
2018-06-27 09:30:11 +00:00
<a class="nav-item" href="#{{ .Title | urlize }}">{{ .Title }}</a>
2018-06-27 08:58:30 +00:00
{{ else }}
<a class="nav-item" href="{{ .RelPermalink }}">
{{ if $pageIsInBlog }}
Back to {{ .Title | singularize}}
{{ else }}
{{ .Title | singularize}}
{{ end }}
</a>
{{ end }}
{{ end }}
{{ end }}
2018-06-11 23:39:40 +00:00
2018-06-27 08:58:30 +00:00
{{ with .Site.GetPage "page" "contact" }}
2018-07-01 08:09:29 +00:00
<a class="nav-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a>
2018-06-27 08:58:30 +00:00
{{ end }}
2018-06-27 00:10:46 +00:00
2018-06-27 08:58:30 +00:00
{{ range $.Site.Home.AllTranslations.ByWeight }}
<a class="nav-item" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
{{ end }}
2018-06-11 23:39:40 +00:00
2018-06-27 08:58:30 +00:00
{{ if and .Site.Params.showRSSButton .Site.RSSLink }}
<a class="nav-item" href="{{ .Site.RSSLink }}"><i class="fa fa-rss"></i></a>
{{ end }}
{{ if not .Page.IsHome }}
</div>
2018-06-11 23:39:40 +00:00
{{ end }}
2018-06-27 08:58:30 +00:00
</nav>
<hr>
2018-06-11 23:39:40 +00:00
</div>
<!-- End Nav bar -->