Skip to content
This repository has been archived by the owner on May 2, 2024. It is now read-only.

Difficult to override default tags #70

Closed
TheAlexLichter opened this issue Dec 7, 2022 · 14 comments · Fixed by #93
Closed

Difficult to override default tags #70

TheAlexLichter opened this issue Dec 7, 2022 · 14 comments · Fixed by #93
Assignees
Labels
enhancement New feature or request

Comments

@TheAlexLichter
Copy link
Contributor

Hey!

Since faa5ad6, it is not possible to override the correct meta tags without providing the hid. I think and hid (or better - key) is only necessary for tags which can appear multiple times, like the image.

@TheAlexLichter TheAlexLichter changed the title Override default tags Difficult to override default tags Dec 7, 2022
@kevinmarrec
Copy link
Owner

kevinmarrec commented Dec 8, 2022

I think that any tag should be able to be overridden with usages of useHead, which takes hid into account.

hid is probably the best to be based on for meta tags, but key is still relevant for links as it's different from metas.

Do you have any idea of improvement ?

@harlan-zw
Copy link
Contributor

harlan-zw commented Dec 9, 2022

Hey @kevinmarrec

Firstly, nice job on the module.

I'd recommend not using hid or key for deduping. All meta tags will be deduped automatically for you. This also allows users to override them easily.

By providing a hid you are actually allowing these tags to be duplicated.

Also, you could make use of the https://unhead.harlanzw.com/guide/guides/useseometa function

@kevinmarrec
Copy link
Owner

Without hid there has been an issue where Nuxt useHead wouldn't override the one set by this module, hid is required for SSR isn't it ? I may miss some best practice usage of head/seo/meta functions.

@kevinmarrec kevinmarrec added the enhancement New feature or request label Dec 19, 2022
@kevinmarrec
Copy link
Owner

@manniL Do you have any idea how to make it better while not breaking stuff ? Is it about removing hid from some meta tags that are not relevant to be overridden ?

@harlan-zw
Copy link
Contributor

Without hid there has been an issue where Nuxt useHead wouldn't override the one set by this module, hid is required for SSR isn't it ? I may miss some best practice usage of head/seo/meta functions.

This isn't a Nuxt 3.0 stable issue, you may have experienced it with one of the early RCs though.

You can read further about the logic here: https://unhead.harlanzw.com/guide/guides/handling-duplicates

@kevinmarrec
Copy link
Owner

@manniL Is this still an issue ?

@TheAlexLichter
Copy link
Contributor Author

I'll have a look when I'm back from holiday 😋

@kevinmarrec
Copy link
Owner

@manniL Cool thank you !

@TheAlexLichter
Copy link
Contributor Author

TheAlexLichter commented Jan 5, 2023

But from what I know + @harlan-zw's answer, yes. This is due to hid allows duplication. IMO the use case where hid makes the most sense is for tags that can be duplicated, e.g. for link (see vueuse/head#158).

So my proposed solution would be using hid only for these kind of tags that are not deduped anyway (like link) and remove it for the rest 😋
Users can always set their own hid or key to ensure that deduplication will not happen for their own tags.

@kevinmarrec
Copy link
Owner

@manniL Sorry to bother you but would you mind making a quick PR to showcase your comment ? 🙏🏻

@TheAlexLichter
Copy link
Contributor Author

@kevinmarrec Sure! Please assign me to the issue and I'll give it a spin when I can 😋

@kevinmarrec
Copy link
Owner

@manniL Thank you very much, no rush 😉

@harlan-zw
Copy link
Contributor

harlan-zw commented Feb 5, 2023

PR sent #93. Sorry @manniL, thought I'd jump in since I got a notification 😛

harlan-zw added a commit to harlan-zw/nuxt-pwa-module that referenced this issue Feb 5, 2023
@TheAlexLichter
Copy link
Contributor Author

@harlan-zw Thanks! No worries at all 😋

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants