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

Override in component #1

Open
sp0ken opened this issue Jan 5, 2018 · 4 comments
Open

Override in component #1

sp0ken opened this issue Jan 5, 2018 · 4 comments

Comments

@sp0ken
Copy link

sp0ken commented Jan 5, 2018

Hi,

Is there a way to override the default meta from within a component?
Similar to what vue-meta does with its head() function.

Cheers,

@LeCoupa
Copy link

LeCoupa commented Oct 9, 2019

From the source code, it looks he is just overriding vue-meta. I guess you should just override the value in a component like you are already doing it.

@wboka
Copy link

wboka commented Nov 23, 2020

Does anyone have an example of overriding this in a component? I'm at a loss over here.

@edoardomazzon
Copy link
Contributor

@wboka Yes, you can override in a pages/component like this (remember ALWAYS the hid property !!) :

...
head() {
    return {
      title:
        'Hi, I'm the title',
      meta: [
        {
          hid: 'og:title',
          property: 'og:title',
          content:
            'Hi, I'm the title',
        },
        {
          hid: 'description',
          name: 'description',
          content:
            'Hi, I'm the description',
        },
        {
          hid: 'og:description',
          name: 'og:description',
          content:
            'Hi, I'm the description',
        },
        ...
}
...

For the first title it will automatically overwrite, while for all the other meta properties (such as og: title, og: description, etc.) the hid attribute must be entered to override the desired property.
I hope I was clear and helpful!

@borisdayma
Copy link

It would be great to have a shortcut to enter the details as per nuxt-social-meta tags (instead of filling each individual field).

edoardomazzon added a commit to edoardomazzon/nuxt-social-meta that referenced this issue Aug 23, 2021
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

5 participants