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
Use title
and titleTemplate
in other tags.
#102
Comments
Unless you track a template outside of Helmet to feed into both PRs are welcome as well. Let me know if you decide to give it a try. |
@cwelch5 Thanks for the reply. I am just starting to implement Helmet in our project now. I had a feeling that was the case. I'll probably take a crack at this sometime next month after I take care of some higher priority issues within our project. The thing with those social type media tags is there's a bit of overlap. My thought was to add support for a |
Another scenario in which you might also want a shared template is for the canonical url, currently all my views end up repeating the value for the canonical link and the open graph url: <Helmet
link={[
// ...
{ rel: 'canonical', href: CANONICAL }
]}
meta={[
// ...
{ property: 'og:url', content: CANONICAL }
]}
/> |
Hey you guys - love Helmet! Already using it in production How about this:
That returns:
Would that work? And the same for other common tags? og:url, og:description/twitter:description, og:image/twitter:image ? I can have a total go at a PR Thoughts? |
Not sure that's necessary since you can handle
|
Oh yeah - I'm totally doing that already But it's 3 lines of code per same tag! More error prone And it's a nice social feature and anybody who needs social integration would have their lives made easier by React Helmet Don't you think? |
I don't think the addition of these flags would be intuitive or add value to the API since configuration is really easy to understand right now. Ultimately you're saving 1 or 2 lines of configuration at the cost of an API that would be coupled to specific tags in a specific social network. Hard to grok different merge scenarios say if you have this flag set but still provide The better solution would be for Facebook/Twitter to default to the |
@potench I see your point on this regarding making the API more difficult to manage. And I think your proposal to have Facebook/Twitter to default to title/description makes sense. Though |
@potench Actually @brianespinosa brings up a really good point! How about adding "og" and "twitter" meta capabilities to the API? This way you can set them more properly than just generic "meta" - which you sometimes end up setting A LOT of in a big chunk of JSX Does that for you? |
@brianespinosa @edoardo-bluframe this use-case could also be abstracted at the project level: // titleMeta.js
export function titleMeta(title) {
return {
title,
meta: [
{"property": "og:title", "content": title},
{"property": "twitter:title", "content": title}
]
}
} import {titleMeta} from "./titleMeta.js";
<Helmet {...titleMeta("Some Title")} /> |
For my use case, I'd like to be able to capture the resolved title (preferably without applying the template) so I can sync it with a material-ui AppBar (header section) |
@rosskevin You can use the callback you specify with |
@cwelch5 I actually cannot get the I could parse it, but since this issue is contemplating using title, I'd like to see (a possible value) without the template applied. |
I have the same problem as @rosskevin, any way to get the raw title from callback? |
Closing - This issues is over a year old. If needed, please feel free to file a new issue. |
I am rendering open graph and twitter meta tags and I would like to set the
og:title
andtwitter:title
content values to the same as what you render by combining thetitle
andtitleTemplate
props. Is there a way to set those content values using that same process?The text was updated successfully, but these errors were encountered: