Skip to content

feat(theme-classic): use lang attribute in navbar locale dropdown items#7942

Merged
slorber merged 2 commits into
mainfrom
slorber/use-lang-attribute-in-locale-dropdown
Aug 12, 2022
Merged

feat(theme-classic): use lang attribute in navbar locale dropdown items#7942
slorber merged 2 commits into
mainfrom
slorber/use-lang-attribute-in-locale-dropdown

Conversation

@slorber

@slorber slorber commented Aug 11, 2022

Copy link
Copy Markdown
Collaborator

Motivation

Apparently, this improves accessibility a bit, and also helps SEO crawlers

https://twitter.com/mgechev/status/1518447256034238464
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang
https://www.w3schools.com/tags/att_global_lang.asp


Note: wonder if we shouldn't also use it for localized sites where some docs are not translated yet 🤷‍♂️ I guess the lang of a doc in such case is not the lang of the i18n site (as the doc is actually not translated) but the default locale instead

@slorber slorber added pr: polish This PR adds a very minor behavior improvement that users will enjoy. domain: i18n Related to the i18n system labels Aug 11, 2022
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 11, 2022
@netlify

netlify Bot commented Aug 11, 2022

Copy link
Copy Markdown

[V2]

Name Link
🔨 Latest commit 7c4cecf
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/62f62a7131d47a0008ad86b4
😎 Deploy Preview https://deploy-preview-7942--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@github-actions

github-actions Bot commented Aug 11, 2022

Copy link
Copy Markdown

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟢 94 🟢 98 🟢 100 🟢 100 🟠 80 Report
/docs/installation 🟠 82 🟢 100 🟢 100 🟢 100 🟢 90 Report

@github-actions

github-actions Bot commented Aug 11, 2022

Copy link
Copy Markdown

Size Change: +75 B (0%)

Total Size: 812 kB

Filename Size Change
website/build/index.html 40.8 kB +56 B (0%)
ℹ️ View Unchanged
Filename Size Change
website/.docusaurus/globalData.json 52.5 kB 0 B
website/build/assets/css/styles.********.css 111 kB 0 B
website/build/assets/js/main.********.js 608 kB +19 B (0%)

compressed-size-action

@Josh-Cena Josh-Cena removed the domain: i18n Related to the i18n system label Aug 11, 2022
Comment thread packages/docusaurus-types/src/i18n.d.ts Outdated
* `<link ... hreflang="...">`
* BCP 47 language tag to use in:
* - `<html lang="...">`
* - `<li lang="...">`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<li> or <a>, or doesn't really matter? Also need to put this into the actual docs since they are in sync.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced by

`<html lang="...">` (or any other DOM tag name)

Somehow HTML, li, a are all the case case 🤪

@Josh-Cena Josh-Cena added the domain: i18n Related to the i18n system label Aug 11, 2022
@slorber slorber added the to backport This PR is planned to be backported to a stable version of Docusaurus label Aug 12, 2022
@slorber slorber merged commit ad15605 into main Aug 12, 2022
@slorber slorber deleted the slorber/use-lang-attribute-in-locale-dropdown branch August 12, 2022 10:33
@slorber slorber added backported This PR has been backported to a stable version of Docusaurus and removed to backport This PR is planned to be backported to a stable version of Docusaurus labels Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported This PR has been backported to a stable version of Docusaurus CLA Signed Signed Facebook CLA domain: i18n Related to the i18n system pr: polish This PR adds a very minor behavior improvement that users will enjoy.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants