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

Can you remove a parent meta value? #288

Closed
hecktarzuli opened this issue Dec 3, 2018 · 13 comments
Closed

Can you remove a parent meta value? #288

hecktarzuli opened this issue Dec 3, 2018 · 13 comments

Comments

@hecktarzuli
Copy link

Really a question, not an issue. I set canonical at the App.vue level (root) but would like to remove the tag under certain conditions in child comps (like when we set something to noindex,nofollow).

Is there any way for a child comp to remove the parent meta tag? It seems like vmid would REPLACE it, but I'd like to totally nuke it. I'd like to not use any trickery via Vuex and would like to stay in vue-meta land if possible :)

@pimlie
Copy link
Collaborator

pimlie commented Mar 7, 2019

Unfortunately this is not possible. Do you have a suggestion how this would work?

Eg currently vue-meta works by deepmerging all the metaInfo objects of the components on a page, which means by design that adding/overwriting works but deleting wont unless we introduce a special case of meta.content === false

@pimlie
Copy link
Collaborator

pimlie commented Mar 8, 2019

@manniL Wdyt about this? I think #204 is similar

@manniL
Copy link
Member

manniL commented Mar 8, 2019

@pimlie Not sure whether that would add too much complexity 🤔

@pimlie
Copy link
Collaborator

pimlie commented Mar 8, 2019

I think this should work by ignoring source when source[contentKeyName] === false or source.innerHTML === false in arrayMerge and when we delete data properties in getComponentOption when there are false so they dont get deepmerged.

@manniL
Copy link
Member

manniL commented Mar 8, 2019

@pimlie I'd probably tend to use null for it as false could be a valid value 🤔 But yeah, that sounds like a decent approach 👏

@pimlie
Copy link
Collaborator

pimlie commented Mar 8, 2019

Is false a valid value or 'false'? Because we actually need two falsy values to differentiate between nuking the parents vmid (this issue) or ignoring the childs (issue 204). I would propose to use null for this issue and false for 204, but you might have a better idea?

@manniL
Copy link
Member

manniL commented Mar 8, 2019

@pimlie hmm. good question, don't know by heart.

hm.. couldn't we use undefined for "No content" and null (or false?) for nuking? ☺️
I think that'd be closer to the semantic expressions for undefined and null

@pimlie
Copy link
Collaborator

pimlie commented Mar 8, 2019

@manniL The only problem I have with undefined is that given a = {} then a.content is also undefined, which means you have to check for both key existence as key value. But will change it for 204

@manniL
Copy link
Member

manniL commented Mar 8, 2019

@pimlie Do we have to distinguish between a = {} and a = { content: undefined }?

@hecktarzuli
Copy link
Author

It's possible I don't understand everything in this lib, but couldn't we just introduce functions or something vs magic values? To me it would make a little more sense to call removeMeta(something) and resetMeta(something) vs setting a value to null, false, etc..

@pimlie
Copy link
Collaborator

pimlie commented Mar 8, 2019

Hmm, maybe its code style preference but a = {} means to me implicit behaviour and a = { content: undefined } means explicit behaviour. Personally I often like the latter because you have to indicate that you want the app to behave in a certain manner so its less likely to do stuff you didnt expect (because you didnt read the docs and really just wanted a meta tag without content like meta charset).

@hecktarzuli The problem with that is where are those functions defined and when are they called? If you have multiple branches with components which define metaInfo then vue-meta will merge all the metaInfo's into one single object. Are those functions called after all the merging has taken place or immediately when a parent and child are merged? And does it call both parent and child functions or only the one of the child? I agree that having functions is nicer but it complicate things and for vue-meta v3 we will probably refactor everything from the ground up anyway. So therefore using null, false is a quick and easy solution for now :)

@pimlie
Copy link
Collaborator

pimlie commented Apr 20, 2019

This issue has been closed as changes for it are included in the v2 release candidate. Please help us testing the release candidate and report any follow-ups in a new issue

@hecktarzuli
Copy link
Author

We'll have to check it out, thank you!

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

No branches or pull requests

3 participants