Comments (18)
Cascading title tag support was added in #37 and will be published as part of an upcoming v3 -- you can play around with it now by installing the next
tag, npm i react-head@next
from react-head.
Any feedback you have on this feature would be appreciated and super helpful right now, as we haven't yet cut an official v3 release 😁
from react-head.
Ah sure will have a look at v3 then :)
from react-head.
Btw, will cascading support be limited to just title tags? What about og:title, og:description etc?
from react-head.
Only title
and meta
are supported currently.
from react-head.
So I just tried the v3 branch, and on the server the headTags array contains only one title tag as expected. However, once rendered, the nested tag gets overwritten by the tag in the root component as soon as a client side update occurs.
Also, meta tags with the following structure doesn't cascade on server nor client:
<Meta property="og:description" content="Some Content" />
from react-head.
I think the next
tag is an older build, I'll cut a new one with the latest on master (I think that will include the meta support).
from react-head.
Great thanks @tizmagik
from react-head.
Just published 3.0.0-1
(against @next
tag). Give that a spin 😁
from react-head.
Yay works on the server now with the meta tags but still have the issue where it gets overwritten by the first occurring tag and title whenever client side rendering/updating kicks in.
I also get an error when navigating away from any page with nested titles or tags in its component tree:
this.headTags.removeClientTag is not a function at HeadTag.componentWillUnmount
from react-head.
Thanks for the bug report @klase ! -- cc @TrySound
from react-head.
@klase Do you have HeadProvider in your tree in client?
from react-head.
I'm seeing this too on 3.0.0-1
, client side only, with a HeadProvider
. A title
tag is defined in our index.html, and it's not being overwritten by the Title
react-head
tag (a second title
tag is inserted in head
by react-head
, but it's ignored by the browser). react-helmet
doesn't have the same issue, it seems to replace the existing title.
from react-head.
ahh nope 🤦♂️ thanks @TrySound. Maybe it can be added to the Client Setup section of the readme to make it clearer.
Unrelated: In the readme you're using renderToString to render the headTags array. Any reason why you're not using renderToStaticMarkup instead to avoid having data-reactroot attributes on all the tags?
from react-head.
@praxxis We are doing "rehydration" only for tags with data-rh
attributes. Removing another stuff won't affect SSR and may break something. It's probably better to not have title
tag in your source html.
from react-head.
@klase Nope, could you open an issue about that?
from react-head.
@TrySound sure
from react-head.
Closing this as 3.0.0-1 resolved my initial issue.
from react-head.
Related Issues (20)
- Link canonical cascade HOT 1
- Expose HeadTag? HOT 2
- Question: Does it work without ssr for SEO, on fb and twitter ? HOT 1
- Children prop type missing in HeadProvider HOT 7
- Is this library still maintained? HOT 1
- Suggestion: use renderToStaticMarkup instead of renderToString HOT 4
- Some tags not collected HOT 4
- Invariant failed in HeadTags HOT 9
- Development server not working HOT 2
- does not support ie9? HOT 2
- Proposal: headTagsToElement(headTags) HOT 1
- Element.remove() not supported in IE HOT 3
- Document usage with SSR streaming HOT 3
- TypeScript support HOT 3
- react-head supports meta update on lazy load HOT 3
- itemProp support on <Meta /> HOT 1
- canonical link is repeated HOT 1
- Title component doesn't override default <title> tag provided via HTML template HOT 10
- Entities in computed attribute values? Suggested approach? HOT 5
- RFC: Managing tags without extra markup HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-head.