Closed krstffr closed 9 years ago
This is what I would like to avoid (here I'm using the addMeta
method when navigating from one page to another):
Looks good to me. Implement this in the server as well.
Hi @arunoda!
I guess that would require something like a new removeFromHead
method in the flow-router-ssr packages?
https://github.com/kadirahq/flow-router/blob/ssr/server/ssr_context.js
In the SSR you don't need to remove. Just call addMeta. On 2015 ඔක් 2, සිකු at ප.ව. 7.52 Kristoffer Klintberg < notifications@github.com> wrote:
Hi!
I guess that would require something like a new removeFromHead method in the flow-router-ssr packages?
https://github.com/kadirahq/flow-router/blob/ssr/server/ssr_context.js
— Reply to this email directly or view it on GitHub https://github.com/kadirahq/meteor-dochead/pull/13#issuecomment-145035752 .
OK, I'm not entirely sure how the ssr side of this all works, but I tried adding the method to the server and a test for it as well. Please look this over though as I'm not sure it's correctly implemented! @arunoda
Sorry, forgot to remove some code, new commit in a minute! @arunoda
Hey @arunoda, are you still waiting for me to do something or is everything ready for a merge? :) Thanks!
Actually, We didn't had this issue and I waited a bit for look at how we did this. Here's how:
For every route change we call DocHead.removeDocHeadAddedTags()
to clean them.
Frankly, having something like setMeta
is interesting, but since we can't do it inside the server for now, I'll hold this.
We can do this, once we figure out a way to do this inside the server.
Oh, i did not know about that method, cool!
And I forgot about it too :)
May be better to add to README.
Would be great!
Seem to work just like expected!
Should I remove this pull request?
Yep. Let's close this. On 2015 ඔක් 6, අඟහ at ප.ව. 2.51 Kristoffer Klintberg < notifications@github.com> wrote:
Seem to work just like expected!
Should I remove this pull request?
— Reply to this email directly or view it on GitHub https://github.com/kadirahq/meteor-dochead/pull/13#issuecomment-145795705 .
Added a setMeta method which unlike addMeta does not append new meta tags on each call.
For example: if you run
DocHead.addMeta({ name: "description", content: "Some content" })
you will end up with TWO<meta name="description">
tags in your<head>
, which you now can avoid by using the setMeta method (which makes sure there is always at most one tag at a time).Only added the method on client since it don't make (as much) sense on the server to run the addMeta more than once.