Welcome to mirror list, hosted at ThFree Co, Russian Federation.

header.html « partials « layouts - github.com/spech66/bootstrap-bp-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: eb6118e162c80ce28fd0fd79c8737a3af77fc6a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{{ $alwaysExpandMenu := "" }}
{{ if and (.Site.Params.alwaysExpandMenu) (eq .Site.Params.alwaysExpandMenu true) }}
    {{ $alwaysExpandMenu = "navbar-expand-lg" }}
{{ end }}

{{ $navClasses := "navbar-light bg-white" }}
{{ if and (.Site.Params.themeColor) (eq .Site.Params.themeColor "dark") }}
    {{ $navClasses = "navbar-dark bg-dark" }}
{{ end }}

<nav class="navbar {{ $navClasses }} {{ $alwaysExpandMenu }} border-bottom">
    <div class="container">
        <a class="navbar-brand text-primary" href="/">{{ .Site.Title }}</a>
        <button class="navbar-toggler collapsed" 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>

        <div class="navbar-collapse collapse" id="navbarCollapse">
            <ul class="navbar-nav mr-auto">
                {{ $currentPage := . }}
                {{ range $index, $element := .Site.Menus.main }}
                    {{ if .HasChildren }}
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle text-primary" href="#" id="dropdown{{$index}}" data-toggle="dropdown"
                                aria-haspopup="true" aria-expanded="false">{{ .Pre }} {{ .Name }}</a>
                            <div class="dropdown-menu" aria-labelledby="dropdown{{$index}}">
                            {{ range .Children }}
                                <a class="dropdown-item text-primary" href="{{ .URL }}">{{ .Pre }} {{ .Name }}</a>
                            {{ end }}
                            </div>
                        </li>
                    {{ else }}
                        <li class="nav-item">
                            <a class="nav-link text-primary" href="{{ .URL }}">{{ .Pre }} {{ .Name }}</a>
                        </li>
                    {{ end }}
                {{ end }}
            </ul>
        </div>
    </div>
</nav>