Use unified navbar for all pages
Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
parent
5a9af3cc46
commit
cb0ae29984
24 changed files with 243 additions and 298 deletions
|
@ -37,6 +37,11 @@
|
|||
{{ $invertedLogo = $invertedLogo.RelPermalink}}
|
||||
{{ end }}
|
||||
|
||||
{{ $logo := $mainLogo }}
|
||||
{{ if .IsHome }}
|
||||
{{ $logo = $invertedLogo }}
|
||||
{{ end }}
|
||||
|
||||
{{ $customMenus := site.Params.customMenus }}
|
||||
{{ if (index site.Data site.Language.Lang).site.customMenus }}
|
||||
{{ $customMenus = (index site.Data site.Language.Lang).site.customMenus }}
|
||||
|
@ -47,29 +52,34 @@
|
|||
{{ $sections = (index site.Data site.Language.Lang).sections }}
|
||||
{{ end }}
|
||||
|
||||
<nav class="navbar navbar-expand-xl top-navbar initial-navbar" id="top-navbar">
|
||||
<nav class="navbar navbar-expand-xl top-navbar shadow {{ if .IsHome}}transparent-navbar homepage{{end}}" id="top-navbar">
|
||||
<div class="container">
|
||||
{{ if not .IsHome }}
|
||||
<button class="navbar-toggler navbar-light" id="sidebar-toggler" type="button">
|
||||
<i data-feather="sidebar"></i>
|
||||
</button>
|
||||
{{ end }}
|
||||
<a class="navbar-brand" href="{{ site.BaseURL | relLangURL }}">
|
||||
{{ if $invertedLogo }}
|
||||
<img src="{{ $invertedLogo }}" id="logo" alt="Logo">
|
||||
{{ if $logo }}
|
||||
<img src="{{ $logo }}" id="logo" alt="Logo">
|
||||
{{ end }}
|
||||
{{- site.Title -}}
|
||||
</a>
|
||||
<button
|
||||
class="navbar-toggler navbar-dark"
|
||||
class="navbar-toggler {{if .IsHome}}navbar-dark{{else}}navbar-light{{end}}"
|
||||
id="navbar-toggler"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#top-nav-items"
|
||||
aria-label="menu"
|
||||
>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
<i data-feather="menu"></i>
|
||||
</button>
|
||||
|
||||
<div class="collapse navbar-collapse dynamic-navbar" id="top-nav-items">
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#home">{{ i18n "home" }}</a>
|
||||
<a class="nav-link" href="{{ site.BaseURL | relLangURL }}#home">{{ i18n "home" }}</a>
|
||||
</li>
|
||||
{{ if $sections }}
|
||||
{{ $sectionCount := 1 }}
|
||||
|
@ -78,7 +88,7 @@
|
|||
{{ $sectionCount = add $sectionCount 1}}
|
||||
{{ if le $sectionCount $maxVisibleSections }}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
|
||||
<a class="nav-link" href="{{ site.BaseURL | relLangURL }}#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
@ -92,7 +102,7 @@
|
|||
{{ if and (.section.enable) (.section.showOnNavbar) }}
|
||||
{{ $sectionCount = add $sectionCount 1}}
|
||||
{{ if gt $sectionCount $maxVisibleSections }}
|
||||
<a class="dropdown-item" href="#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
|
||||
<a class="dropdown-item" href="{{ site.BaseURL | relLangURL }}#{{ partial "helpers/get-section-id.html" . }}">{{ .section.name }}</a>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
|
@ -106,12 +116,12 @@
|
|||
{{ end }}
|
||||
{{ if $blogEnabled }}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="blog-link" href="{{ "/posts/" | relLangURL }}">{{ i18n "posts" }}</a>
|
||||
<a class="nav-link" id="blog-link" href="{{ path.Join (site.BaseURL | relLangURL) "posts" }}">{{ i18n "posts" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ if $notesEnabled }}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="note-link" href="{{ "/notes/" | relLangURL }}">{{ i18n "notes" }}</a>
|
||||
<a class="nav-link" id="note-link" href="{{ path.Join (site.BaseURL | relLangURL) "notes" }}">{{ i18n "notes" }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ range $customMenus }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue