Skip to content
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

Add option to add lang attribute to useLocaleHead composable #2712

Closed
3 of 4 tasks
Tracked by #3002
karol-bujacek opened this issue Jan 19, 2024 · 0 comments · Fixed by #3097
Closed
3 of 4 tasks
Tracked by #3002

Add option to add lang attribute to useLocaleHead composable #2712

karol-bujacek opened this issue Jan 19, 2024 · 0 comments · Fixed by #3097
Assignees
Labels
feature request SEO Related to SEO features such as head tags v8

Comments

@karol-bujacek
Copy link

Describe the feature

useLocaleHead composable should return the current language which can be added to the <html lang='…'>. However the value is present only if useLocaleHead is called with addSeoAttributes: true, see /src/runtime/routing/compatibles/head.ts#L52.

Yes, the lang attribute is probably related to SEO, but in my opinion that relation is not as strong as its relation to the locale and basic functionality of useLocaleHead. You can also notice that the useLocaleHead composable is returning an empty state if it is called as useLocaleHead({}), which might look more like a bug than words “language is related to the SEO”. Maybe the function may return lang attribute by default, but probably not right now as it might be considered as a breaking change.

I am thinking about new addLangAttribute which sets metaObject.htmlAttrs.lang regardless of addSeoAttributes value. The current behavior should be probably untouched until some major version changes (which might be quite long because the current version is 8.0.0, but it may not be a serious problem).

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request SEO Related to SEO features such as head tags v8
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants