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

Feature Request: Add fine-grained control for og:url and other Open Graph meta tags in useLocaleHead #3277

Open
3 of 4 tasks
Frank3K opened this issue Dec 23, 2024 · 0 comments

Comments

@Frank3K
Copy link

Frank3K commented Dec 23, 2024

Describe the feature

Description

Currently, the useLocaleHead composable in the nuxt3-i18n module automatically generates various meta tags, including og:url, based on non-configurable logic. While this works for many use cases, it creates challenges when custom logic is required.

Use Case

In our project, we manually determine the og:url using project-specific logic. We set this custom og:url using the useSeoMeta method. However, when using useLocaleHead with default properties, it adds a second og:url meta tag, which cannot be disabled or customized without affecting other tags.

Setting seo: false in useLocaleHead disables all SEO-related meta tags, including og:locale:alternate tags and og:locale for the current page. This is problematic because we only want to disable the automatic generation of og:url, while retaining the other meta tags provided by useLocaleHead.

The relevant behavior can be seen in the following code snippet:

// Adding SEO Meta
if (seo && locale && unref(nuxtApp.$i18n.locales)) {
metaObject.link.push(...getHreflangLinks(common, locales, key), ...getCanonicalLink(common, key, seo))
metaObject.meta.push(
...getOgUrl(common, key, seo),
...getCurrentOgLocale(currentLocale, currentLanguage, key),
...getAlternateOgLocales(locales, currentLanguage, key)
)
}

PR

I’d be happy to contribute a pull request (PR) to implement this feature if the idea is welcomed.

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
Projects
None yet
Development

No branches or pull requests

1 participant