harlan-zw / nuxt-site-config

Unifying site config with powerful and flexible APIs, for module authors and users.
https://nuxtseo.com/site-config
MIT License
65 stars 6 forks source link

fix: `package.json`'s description takes precendence over `i18n`'s description #26

Closed dargmuesli closed 8 months ago

dargmuesli commented 8 months ago

Describe the bug

It seems like package.json's description takes precendence over i18n's description. I have some description field in a package.json and locales/[de|en].json (two files) containing

{
  "nuxtSiteConfig": {
    "description": "..."
  }
}

I'd expect the locale files' descriptions to take precedence but I see the package.json locales' descriptions being preferred instead.

Reproduction

Can add one if necessary.

System / Nuxt Info

No response

dargmuesli commented 8 months ago

Removing the package.json's description let's the head meta tags description and og:description disappear. It seems the i18n descriptions are not loaded at the time those meta tags are created?

I can use useServerSeoMeta({ description: siteConfig.description, ogDescription: siteConfig.description }) as a workaround though. i18n is loaded when using const siteConfig = useSiteConfig().

harlan-zw commented 8 months ago

Can you provide some more context on how you're using it? If you're accessing the site config within a plugin you'll need to run it after the site config i18n plugin.

export default defineNuxtPlugin({
  dependsOn: ['nuxt-site-config:i18n'],
  // ...
})

I only actually realised this is an issue recently, I've pushed up a fix in Nuxt SEO with the same issue.

dargmuesli commented 8 months ago

It seems another dependency update resolved the issue. Thank you!