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

Expose the head SEO function to be used in layouts #154

Merged
merged 8 commits into from
Nov 15, 2018

Conversation

adrienbaron
Copy link

@adrienbaron adrienbaron commented Nov 7, 2018

This PR exposes the SEO head hook function as this.$nuxtI18nSeo on components.

This allows to disable seo head mixin on all components (by setting seo: false in nuxt i18n options).
Then it's possible to do this in your app layout (or wherever):

    head () {
      return this.$nuxtI18nSeo()
    },

This greatly improves performance as SEO links are not recomputed for every components but only for the layout itself.

This changes is not breaking as the default global registration with the same behaviour remains if seo: true in the configuration.

Resolves: #144

@paulgv
Copy link
Collaborator

paulgv commented Nov 8, 2018

Thanks @adrienbaron !
Could you also update the documentation to explain how to use the nuxtI18nSeo() method?

@adrienbaron
Copy link
Author

@paulgv Done!
Btw thanks a lot to @manniL for his help on this, forgot to mention, and couldn't have done it without his help 👍

@manniL
Copy link
Contributor

manniL commented Nov 8, 2018

Happy we found a solution 🙊 (Also one that can be default at the next major version)

src/plugins/main.js Outdated Show resolved Hide resolved
@manniL manniL merged commit ce373c4 into nuxt-modules:master Nov 15, 2018
@kevinmarrec
Copy link

@adrienbaron @manniL Last commit on master seems to be related to this PR, and tests are not passing anymore, any ideas ? (CircleCI build fails)

@manniL
Copy link
Contributor

manniL commented Nov 18, 2018

@kevinmarrec Should be just the vue-ssr id(4eb03412:0). Will fix

@manniL
Copy link
Contributor

manniL commented Nov 18, 2018

@kevinmarrec fixed

Copy link

@harmnot harmnot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why $nuxtI18nSeo is not a function ??

@manniL
Copy link
Contributor

manniL commented Dec 5, 2018

@harmnot There hasn't been a release yet

@harmnot
Copy link

harmnot commented Dec 5, 2018

I was asking this https://cmty.app/nuxt/nuxt-i18n/issues/c176

@harmnot
Copy link

harmnot commented Dec 5, 2018

then, I try to find out, and follow the instruction https://github.com/nuxt-community/nuxt-i18n/blob/master/docs/seo.md here and after that , show the $nuxtI18nSeo is not a function

@paulgv
Copy link
Collaborator

paulgv commented Jan 24, 2019

Sorry for the delay, this wasn't released until recently in version 5.5.0: https://github.com/nuxt-community/nuxt-i18n/blob/master/CHANGELOG.md#550-2019-01-14

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

Successfully merging this pull request may close these issues.

None yet

5 participants