Fully working for old versions without i18n

This commit is contained in:
Hugo MARTIN 2020-08-05 19:51:35 +02:00 committed by Emruz Hossain
parent e9af2f70d2
commit 10707b361e
3 changed files with 38 additions and 1 deletions

View file

@ -48,6 +48,25 @@
{{end}} {{end}}
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ else if .Site.Data.sections }}
{{ $background:= "bg-white"}}
{{ range sort .Site.Data.sections "section.weight" }}
{{ if .section.enable }}
<div class="container-fluid section-holder d-flex {{ $background }}">
{{ if .section.template }}
{{- partial .section.template . -}}
{{ else }}
{{- partial (printf "sections/%s.html" (replace (lower .section.name) " " "-")) . -}}
{{ end }}
</div>
<!--- alter background color for next section --->
{{ if eq $background "bg-white" }}
{{ $background = "bg-dimmed" }}
{{ else }}
{{ $background = "bg-white" }}
{{end}}
{{ end }}
{{ end }}
{{ end }} {{ end }}
<!--- ADD FOOTER -----------------------> <!--- ADD FOOTER ----------------------->

View file

@ -13,6 +13,16 @@
{{ end }} {{ end }}
{{- end }} {{- end }}
</ul> </ul>
{{ else if .Site.Data.sections }}
<ul>
{{- range sort .Site.Data.sections "section.weight" }}
{{ if and (.section.enable) (.section.showOnNavbar)}}
<li class="nav-item">
<a class="smooth-scroll" href="/#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
</li>
{{ end }}
{{- end }}
</ul>
{{ end }} {{ end }}
</div> </div>

View file

@ -8,7 +8,7 @@
{{ if .Site.Params.logo.inverted }} {{ if .Site.Params.logo.inverted }}
{{ $invertedLogo = .Site.Params.logo.inverted }} {{ $invertedLogo = .Site.Params.logo.inverted }}
{{ end }} {{ end }}
<a class="navbar-brand" href="{{ .Site.BaseURL }}/{{ .Site.Language.Lang }}"> <a class="navbar-brand" href="{{ .Site.BaseURL }}{{ if .IsTranslated }}/{{ .Site.Language.Lang }}{{end}}">
<img src="{{ $invertedLogo }}" id="logo"> <img src="{{ $invertedLogo }}" id="logo">
{{- .Site.Title -}} {{- .Site.Title -}}
</a> </a>
@ -35,6 +35,14 @@
</li> </li>
{{ end }} {{ end }}
{{- end }} {{- end }}
{{ else if .Site.Data.sections }}
{{ range sort .Site.Data.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 }} {{- end }}
{{ $hasCustomMenus:= false }} {{ $hasCustomMenus:= false }}
{{ if and site.Params.customMenus }} {{ if and site.Params.customMenus }}