-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docusaurus does not generate og:locale and og:locale:alternate meta tags #8887
Comments
Can you explain to me when/how this metadata is used? We already output hreflang metadata. See for example on https://docusaurus.io/docs/installation <html lang="en">
<head>
<link
data-rh="true"
rel="canonical"
href="https://docusaurus.io/docs/installation"
/>
<link
data-rh="true"
rel="alternate"
href="https://docusaurus.io/docs/installation"
hreflang="en"
/>
<link
data-rh="true"
rel="alternate"
href="https://docusaurus.io/fr/docs/installation"
hreflang="fr"
/>
<link
data-rh="true"
rel="alternate"
href="https://docusaurus.io/pt-BR/docs/installation"
hreflang="pt-BR"
/>
<link
data-rh="true"
rel="alternate"
href="https://docusaurus.io/ko/docs/installation"
hreflang="ko"
/>
<link
data-rh="true"
rel="alternate"
href="https://docusaurus.io/zh-CN/docs/installation"
hreflang="zh-CN"
/>
<link
data-rh="true"
rel="alternate"
href="https://docusaurus.io/docs/installation"
hreflang="x-default"
/>
</head>
</html> So this looks a bit like duplicate data to me (and less complete, no URL). Which system reads |
@jdevalk any idea? Should we use The only online refs I could find look in favor of using
https://stackoverflow.com/questions/31861414/canonical-url-and-ogurl-for-multilanguage-site
|
hey @slorber! I think we should definitely output Unfortunately, there's not one unified standard that both Facebook and Google adhere to in these things. |
Thanks @jdevalk , let's do this then! A bit sad that we have to output duplicate info to each html page. With lots of locale that still takes a few useless bytes. Shouldn't be very hard, good issue for someone willing to contribute! Add this next to where we handle hreflang in theme, in (please don't ask to claim the issue, the first draft PR author gets the issue) |
Just realizing that OGP is annoying by not respecting the BCP47 spec ( See https://ogp.me/
<meta property="og:locale" content="en_GB" />
<meta property="og:locale:alternate" content="fr_FR" />
<meta property="og:locale:alternate" content="es_ES" /> Their doc is not very exhaustive but I guess we can just to this and call it a day: function toOgLocale(locale) {
return locale.replace("-","_");
} |
I would like to work on this if possible |
I'd like to work on this |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
The built site does not have og:locale and og:locale:alternate meta tags in the Head.
Reproducible demo
https://codesandbox.io/p/sandbox/zen-wildflower-kpuv6l?file=%2FREADME.md
Steps to reproduce
e.g.
Expected behavior
In the built site pages in the Head tag og:locale and og:locale:alternate meta tags are present.
Actual behavior
In the built site pages in the Head tag og:locale and og:locale:alternate meta tags are not present.
Your environment
Self-service
The text was updated successfully, but these errors were encountered: