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

70 lines
2.1 KiB
HTML
Raw Normal View History

2018-06-11 23:39:40 +00:00
<!-- Begin Nav bar -->
<div class="container">
<hr>
<nav class="nav nav-center">
2018-06-25 13:03:18 +00:00
{{ $isHome := .Page.IsHome }}
{{ if not $isHome }}
2018-06-11 23:39:40 +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">
{{ end }}
2018-06-25 13:03:18 +00:00
{{ if not $isHome }}
2018-06-11 23:39:40 +00:00
<a class="nav-item" href="{{ "/" | relURL }}">Main</a>
{{ end }}
2018-06-25 13:03:18 +00:00
{{ with .Site.GetPage "page" "about" }}
<a class="nav-item" href="{{ if $isHome }}#about{{ else }}{{ "/#about" | relURL }}{{ end }}">{{ .Title }}</a>
{{ end }}
2018-06-11 23:39:40 +00:00
2018-06-25 13:03:18 +00:00
{{ $pageIsInProjects := eq .Page.Section "projects"}}
{{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }}
{{ with .Site.GetPage "section" "projects" }}
{{ if $isHome }}
<a class="nav-item" href="#projects">{{ .Title }}</a>
2018-06-23 09:59:46 +00:00
{{ else }}
<a class="nav-item" href="{{ "/projects" | relURL }}">
2018-06-25 13:03:18 +00:00
{{ if $pageIsInProjects }}
Back to {{ .Title }}
2018-06-23 09:59:46 +00:00
{{ else }}
2018-06-25 13:03:18 +00:00
{{ .Title }}
2018-06-11 23:39:40 +00:00
{{ end }}
2018-06-23 09:59:46 +00:00
</a>
{{ end }}
2018-06-11 23:39:40 +00:00
{{ end }}
2018-06-25 13:03:18 +00:00
{{ end }}
2018-06-11 23:39:40 +00:00
2018-06-25 13:03:18 +00:00
{{ $pageIsInBlog := eq .Page.Section "blog"}}
{{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }}
{{ with .Site.GetPage "section" "blog" }}
{{ if $isHome }}
<a class="nav-item" href="#blog">{{ .Title }}</a>
2018-06-23 09:59:46 +00:00
{{ else }}
<a class="nav-item" href="{{ "/blog" | relURL }}">
2018-06-25 13:03:18 +00:00
{{ if $pageIsInBlog }}
Back to {{ .Title | singularize}}
2018-06-11 23:39:40 +00:00
{{ else }}
2018-06-25 13:03:18 +00:00
{{ .Title | singularize}}
2018-06-23 09:59:46 +00:00
{{ end }}
</a>
{{ end }}
2018-06-11 23:39:40 +00:00
{{ end }}
2018-06-25 13:03:18 +00:00
{{ end }}
2018-06-11 23:39:40 +00:00
2018-06-25 13:03:18 +00:00
{{ with .Site.GetPage "page" "contact" }}
<a class="nav-item" href="{{ if $isHome }}#contact{{ else }}{{ "/#contact" | relURL }}{{ end }}">{{ .Title }}</a>
{{ end }}
2018-06-11 23:39:40 +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>
{{ end }}
</nav>
<hr>
</div>
<!-- End Nav bar -->