Added showFlags parameter

This commit is contained in:
Gabriel Jean 2022-06-13 14:12:11 +00:00 committed by GitHub
parent 9e5b1426e3
commit 5940a4ea5e
4 changed files with 24 additions and 15 deletions

View file

@ -145,6 +145,9 @@ params:
# specify whether you want to show Table of Contents in reading page
enableTOC: true
# specify whether you want the language flags to be displayed.
showFlags: true
# Provide newsletter configuration.
# This feature has been implemented for Mailchimp only for now.
# You can also hide it from the footer.

View file

@ -20,5 +20,10 @@
{{ 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 $countryCode }}

View file

@ -6,7 +6,7 @@
<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">
{{ $countryCode := partial "helpers/country-code.html" . }}
{{ if ne $countryCode nil }}
{{ if ne $countryCode "" }}
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
{{ end }}
{{ site.Language.LanguageName }}

View file

@ -1,7 +1,7 @@
<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">
{{ $countryCode := partial "helpers/country-code.html" . }}
{{ if ne $countryCode nil }}
{{ if ne $countryCode "" }}
<span class="flag-icon flag-icon-{{$countryCode}}"></span>
{{ end }}
{{ site.Language.LanguageName }}
@ -16,3 +16,4 @@
{{ end }}
</div>
</li>