Added showFlags parameter
This commit is contained in:
parent
9e5b1426e3
commit
5940a4ea5e
4 changed files with 24 additions and 15 deletions
|
@ -145,6 +145,9 @@ params:
|
||||||
# specify whether you want to show Table of Contents in reading page
|
# specify whether you want to show Table of Contents in reading page
|
||||||
enableTOC: true
|
enableTOC: true
|
||||||
|
|
||||||
|
# specify whether you want the language flags to be displayed.
|
||||||
|
showFlags: true
|
||||||
|
|
||||||
# Provide newsletter configuration.
|
# Provide newsletter configuration.
|
||||||
# This feature has been implemented for Mailchimp only for now.
|
# This feature has been implemented for Mailchimp only for now.
|
||||||
# You can also hide it from the footer.
|
# You can also hide it from the footer.
|
||||||
|
|
|
@ -20,5 +20,10 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{/* if specified via "params.showFlags" field, then countryCode is set to be empty. */}}
|
||||||
|
{{ if eq site.Params.showFlags false }}
|
||||||
|
{{ $countryCode = "" }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{/* return the country code */}}
|
{{/* return the country code */}}
|
||||||
{{ return $countryCode }}
|
{{ return $countryCode }}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="languageSelector" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="languageSelector" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
{{ $countryCode := partial "helpers/country-code.html" . }}
|
{{ $countryCode := partial "helpers/country-code.html" . }}
|
||||||
{{ if ne $countryCode nil }}
|
{{ if ne $countryCode "" }}
|
||||||
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
|
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ site.Language.LanguageName }}
|
{{ site.Language.LanguageName }}
|
||||||
|
|
|
@ -1,18 +1,19 @@
|
||||||
<li class="nav-item dropdown">
|
<li class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="languageSelector" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="languageSelector" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
{{ $countryCode := partial "helpers/country-code.html" . }}
|
|
||||||
{{ if ne $countryCode nil }}
|
|
||||||
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
|
|
||||||
{{ end }}
|
|
||||||
{{ site.Language.LanguageName }}
|
|
||||||
</a>
|
|
||||||
<div class="dropdown-menu" aria-labelledby="languageSelector">
|
|
||||||
{{ range site.Home.AllTranslations }}
|
|
||||||
<a class="dropdown-item nav-link languages-item" href="{{ .RelPermalink }}">
|
|
||||||
{{ $countryCode := partial "helpers/country-code.html" . }}
|
{{ $countryCode := partial "helpers/country-code.html" . }}
|
||||||
|
{{ if ne $countryCode "" }}
|
||||||
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
|
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
|
||||||
{{ .Language.LanguageName }}
|
{{ end }}
|
||||||
|
{{ site.Language.LanguageName }}
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
<div class="dropdown-menu" aria-labelledby="languageSelector">
|
||||||
</div>
|
{{ range site.Home.AllTranslations }}
|
||||||
</li>
|
<a class="dropdown-item nav-link languages-item" href="{{ .RelPermalink }}">
|
||||||
|
{{ $countryCode := partial "helpers/country-code.html" . }}
|
||||||
|
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
|
||||||
|
{{ .Language.LanguageName }}
|
||||||
|
</a>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue