Add basic navbar

This commit is contained in:
ItsDrike 2021-08-25 14:54:51 +02:00
parent 151423681d
commit 4b002e6734
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD
3 changed files with 32 additions and 0 deletions

View file

@ -9,6 +9,7 @@
<title>{{ partial "title-item.html" . }}{{ .Site.Title }}</title> <title>{{ partial "title-item.html" . }}{{ .Site.Title }}</title>
</head> </head>
<body> <body>
{{ partial "navbar.html" . }}
{{ block "main" . }}{{ end }} {{ block "main" . }}{{ end }}
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

View file

@ -0,0 +1,30 @@
<nav class="navbar navbar-expand-sm navbar-dark">
<!-- Navbar home -->
<a class="navbar-brand" href="{{ ref . "/" }}">
<code>/home/{{ lower .Site.Title }}</code>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<!-- Left side of the Navbar -->
<ul class="navbar-nav mr-auto">
<!-- Navbar pages -->
{{ $home := .Site.GetPage "home" }}
{{ $pages := where .Site.RegularPages.ByTitle "Section" "" }}
{{ $nav_pages := union $pages .Site.Sections }}
{{ $nav_pages = where $nav_pages "Params.hidden_from_navbar" "!=" true }}
{{ range sort $nav_pages "LinkTitle" }}
<li class="nav-item">
<a href="{{ .RelPermalink }}" class="nav-link">
<code>~/{{ urlize .LinkTitle }}</code>
</a>
</li>
{{ end }}
</ul>
</div>
</nav>

View file

@ -7,6 +7,7 @@ $paragraph-margin-bottom: $headings-margin-bottom * 0.85;
@import "node_modules/bootstrap/scss/bootstrap"; @import "node_modules/bootstrap/scss/bootstrap";
$navbar-height: 40px;
$body-color: $gray-300; $body-color: $gray-300;
html, body { html, body {