Skip to content

Commit

Permalink
Fix language switcher behavior on untranslated pages
Browse files Browse the repository at this point in the history
This commit fixes the following:
- The language switcher does not appear if a given page does not
  have any translations.
- The current language shown is not presented as an option in the
  language switcher dropdown.
  • Loading branch information
ericswpark committed Nov 3, 2021
1 parent 89d9d18 commit 88c5412
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions layouts/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

{{ end }}
<li>
{{ if and .Site.IsMultiLingual }}
{{ if and .Site.IsMultiLingual .IsTranslated }}
<ul class="sl-nav" aria-label="Language switcher">
<li>
<input type="checkbox" id="languagepicker" aria-label="switch language" hidden />
Expand All @@ -46,15 +46,11 @@

<ul class="dropdown">

{{ range $.AllTranslations }}
{{ range $.Translations }}

<li>
<a href="{{ .RelPermalink }}" title="{{ .Language.LanguageName }}"
><span
{{ if eq . $.Site.Language }}
class="active"

{{ end }}
aria-label="{{ i18n "ariaLanguage" }}{{ .Language.LanguageName }}"
>{{ .Language.LanguageName }}</span
></a
Expand Down

0 comments on commit 88c5412

Please sign in to comment.