12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- {{ $mainLogo:="/assets/images/main-logo.png" }}
- {{ $invertedLogo:="/assets/images/inverted-logo.png" }}
- {{ if site.Params.logo.main }}
- {{ $mainLogo = site.Params.logo.main }}
- {{ end }}
- {{ if site.Params.logo.inverted }}
- {{ $invertedLogo = site.Params.logo.inverted }}
- {{ end }}
- {{ $sections:= site.Data.sections }}
- {{ if (index site.Data site.Language.Lang).sections }}
- {{ $sections = (index site.Data site.Language.Lang).sections }}
- {{ end }}
- <nav class="navbar navbar-expand-xl top-navbar initial-navbar" id="top-navbar">
- <div class="container">
- <a class="navbar-brand" href="{{ site.BaseURL | relLangURL }}">
- <img src="{{ $invertedLogo | relURL }}" id="logo">
- {{- site.Title -}}
- </a>
- <button
- class="navbar-toggler navbar-dark"
- id="navbar-toggler"
- type="button"
- data-toggle="collapse"
- data-target="#top-nav-items"
- >
- <span class="navbar-toggler-icon"></span>
- </button>
- <div class="collapse navbar-collapse" id="top-nav-items">
- <ul class="navbar-nav ml-auto">
- <li class="nav-item">
- <a
- class="nav-link"
- href="#home"
- data-toggle="collapse"
- data-target=".navbar-collapse"
- aria-controls="collapseExample"
- role="button"
- >
- {{ i18n "home" }}
- </a>
- </li>
- {{ if $sections }}
- {{ range sort $sections "section.weight" }}
- {{ if and (.section.enable) (.section.showOnNavbar)}}
- {{ $sectionID := replace (lower .section.name) " " "-" }}
- {{ if .section.id }}
- {{ $sectionID = .section.id }}
- {{ end }}
- <li class="nav-item">
- <a
- class="nav-link"
- href="#{{ $sectionID }}"
- data-toggle="collapse"
- data-target=".navbar-collapse"
- aria-controls="collapseExample"
- >
- {{ .section.name }}
- </a>
- </li>
- {{ end }}
- {{- end }}
- {{- end }}
- {{ $hasCustomMenus:= false }}
- {{ if and site.Params.customMenus }}
- {{ if gt (len site.Params.customMenus) 0 }}
- {{ $hasCustomMenus = true }}
- {{ end }}
- {{ end }}
- {{ if (or site.Params.enableBlogPost $hasCustomMenus) }}
- <div class="dropdown-divider" id="top-navbar-divider"></div>
- {{ end }}
- {{ if site.Params.enableBlogPost }}
- <li class="nav-item">
- <a class="nav-link" id="blog-link" href="{{ "/posts" | relLangURL }}">{{ i18n "posts" }}</a>
- </li>
- {{ end }}
- {{ range (index site.Data site.Language.Lang).site.customMenus }}
- <li class="nav-item">
- <a class="nav-link" href="{{ .url }}">{{ .name }}</a>
- </li>
- {{ end }}
- {{ if .IsTranslated }}
- {{ partial "navigators/lang-selector.html" . }}
- {{ end }}
- </ul>
- </div>
- </div>
- <!-- Store the logo information in a hidden img for the JS -->
- <img src="{{ $mainLogo | relURL }}" class="d-none" id="main-logo">
- <img src="{{ $invertedLogo | relURL }}" class="d-none" id="inverted-logo">
- </nav>
|