Skip to content

Commit

Permalink
fix: redirect to latest when version isn't latest
Browse files Browse the repository at this point in the history
  • Loading branch information
kecrily committed Mar 22, 2023
1 parent fcf6e8e commit 4d7944f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/src/_data/sites/en.yml
Expand Up @@ -85,6 +85,7 @@ footer:
description: Selecting a language will take you to the ESLint website in that language.
change_language: Change Language
language: Language
latest: Latest
copyright: >
&copy; OpenJS Foundation and ESLint contributors, <a href="https://www.openjsf.org">www.openjsf.org</a>
links:
Expand Down
1 change: 1 addition & 0 deletions docs/src/_data/sites/zh-hans.yml
Expand Up @@ -84,6 +84,7 @@ footer:
description: 切换到你所选择语言版本对应的 ESLint 网站。
change_language: 更改语言
language: 语言
latest: 最新
copyright: >
&copy; OpenJS Foundation and ESLint contributors, <a href="https://www.openjsf.org">www.openjsf.org</a>
links:
Expand Down
9 changes: 7 additions & 2 deletions docs/src/_includes/components/language-switcher.html
Expand Up @@ -14,9 +14,14 @@
<select name="language selector" id="language-select" aria-describedby="language-infobox"
class="c-custom-select switcher__select">
{% for key, other_site in sites %}
<option value="{{ other_site.language.code }}" data-url="https://{{ other_site.hostname }}/docs{{ page.url }}" {% if
site.language.code==other_site.language.code %} selected {% endif %}>
<option
value="{{ other_site.language.code }}"
data-url="https://{{ other_site.hostname }}/docs/latest{{ page.url | prettyURL }}"
{% if site.language.code==other_site.language.code %}selected{% endif %}
>
{{ other_site.language.flag }} {{ other_site.language.name }}
{% if site.language.code!=other_site.language.code %}({{ other_site.footer.language_switcher.latest }})
{% elif GIT_BRANCH=="latest" %}({{ other_site.footer.language_switcher.latest }}){% endif %}
</option>
{% endfor %}
</select>
Expand Down

0 comments on commit 4d7944f

Please sign in to comment.