Code Monkey home page Code Monkey logo

Comments (3)

emilecantin avatar emilecantin commented on June 29, 2024 2

Perhaps we could add a "key" attribute that would allow overwriting parent tags with the same key? I think it would be pretty easy to implement, and it would allow opting-in for a specific, non-standard replacement (thinking about JSON Schema script tags here)

from react-helmet.

cwelch5 avatar cwelch5 commented on June 29, 2024

Currently, if you are trying to render a tag like this: <link rel="icon" type="image/x-icon" href="http://example.com/favicon.ico" /> the primary attribute for the tag would be the href, so if the parent and child have different hrefs, it will render both.

This use case is not currently handled. Thanks for bringing it to our attention. I know we have a rule for canonical links. I think we can make the check more general to say any tags with the same rel except for stylesheets will be considered equal. And thus, the child component can overwrite it.

If we switch the statement to always overwrite if the rel values are the same, we'll need to call out ALL exceptions that cascade, like stylesheet.

from react-helmet.

kidwm avatar kidwm commented on June 29, 2024

@emilecantin I have another idea to solve this problem by setting preserved explicitly like this way:

<Helmet preserved>
  <link rel="apple-touch-icon" sizes="192x192" href="touch-icon.png">
  <link rel="apple-touch-icon" sizes="256x256" href="touch-icon-large.png">
</Helmet>
<Helmet preserved={false}>
  <meta name="description" content="category of my site" />
</Helmet>

from react-helmet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.