hugo-toha/layouts/partials/navigators/floating-lang-selector.html
Emruz Hossain fa946af504
Fix various issues detected by html-proofer (#270)
* Add alt tag to the images

Signed-off-by: hossainemruz <hossainemruz@gmail.com>

* Remove unnecessary /

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
2021-03-29 03:44:33 +06:00

21 lines
No EOL
1.1 KiB
HTML

{{ $pageURL:= .RelPermalink }}
{{ if site.IsMultiLingual }}
{{ $pageURL = strings.TrimPrefix (path.Join "/" .Language.Lang) $pageURL }}
{{ end }}
<div class="dropdown languageSelector">
<a class="btn dropdown-toggle" href="#" id="languageSelector" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ $countryCode := partial "helpers/country-code.html" .Language }}
<img class="flag" src="https://www.countryflags.io/{{ $countryCode }}/flat/16.png" alt="{{ $countryCode }}">
{{ site.Language.LanguageName }}
</a>
<div class="dropdown-menu" aria-labelledby="languageSelector">
{{ range .Translations }}
<a class="dropdown-item nav-link languages-item" href="{{ path.Join "/" (cond (eq .Language.Lang "en") "" .Language.Lang) $pageURL }}">
{{ $countryCode := partial "helpers/country-code.html" .Language }}
<img class="flag" src="https://www.countryflags.io/{{ $countryCode }}/flat/24.png" alt="{{ $countryCode }}">
{{ .Language.LanguageName }}
</a>
{{ end }}
</div>
</div>