* Managing i18n * Fix absolute path * Config files * Home link manage langage * Fixing footer i18n * Implemented i18n on newsletter * Implemented two languages in example * Removed old section directory * Using yaml in data to organize home summary * Fully working for old versions without i18n * Integrating language menu CSS * Fix language dropdown CSS * Refactor translation codes * Remove duplicate code * Fix URL issues * Move customMenus and other site related config into data section * Fix error during language toggle * Only show the available translation for the posts * Handle navbar brand URL properly * Fix responsiveness Co-authored-by: Hugo MARTIN <hugo.martin.69@gmail.com> Co-authored-by: hossainemruz <emruz@appscode.com>
73 lines
2.6 KiB
HTML
73 lines
2.6 KiB
HTML
{{ $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 | absURL }}" 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">{{ i18n "home" }}</a>
|
|
</li>
|
|
{{ if $sections }}
|
|
{{ range sort $sections "section.weight" }}
|
|
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#{{ replace (lower .section.name) " " "-" }}">{{ .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="{{ "/post" | 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 | absURL }}" class="d-none" id="main-logo">
|
|
<img src="{{ $invertedLogo | absURL }}" class="d-none" id="inverted-logo">
|
|
</nav>
|