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

Module initialization breaks "head" functionality on purpose #134

Open
gekkedev opened this issue Sep 24, 2021 · 3 comments
Open

Module initialization breaks "head" functionality on purpose #134

gekkedev opened this issue Sep 24, 2021 · 3 comments

Comments

@gekkedev
Copy link

Issue

It caused me quite a headache and cost me a lot of time, but the way that this module breaks Nuxt's head functionality should be addressed urgently. It resets settings intentionally:

this.options.head = {}

Indeed, there is a warning:
console.warn('[@nuxtjs/gtm] head is provided as a function which is not supported by this module at the moment. Removing user-provided head.')

But: Not everybody checks their server console when the browser console output is pretty accurate every time; and some people are even slowed down on checking the server console due to corporate access restrictions, or only use static builds and never see an error, they only see the program misbehaving...let's not talk about use-cases, there are plenty.

To reproduce:

I've simply installed both @nuxtjs/gtm and the module @nuxtjs/i18n and enabled SEO attribute generation (a pretty common functionality to enable) according to the manual. It doesn't have to be this module, it breaks as soon as you want a bit of dynamic code to fill your head setting (using a function instead of an object).

I'm trying some stuff to fix this, but until there is an official bugfix, any workaround would be decent.

@zipme
Copy link

zipme commented Sep 27, 2021

This also happens when we use @nuxtjs/composition-api's useMeta

@enzolry
Copy link

enzolry commented Nov 27, 2021

@gekkedev I think I've found the solution. I've replaced the head() function inside nuxt.config.js by a head object with only the static tags. And I've moved all the dynamic ones (especially i18n) to a head() function inside the layouts/default.vue file.

@juliomontilla100
Copy link

Any update for this? I think a lot of people use nuxt with i18n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants