kodyl / react-document-meta

HTML meta tags for React-based apps. Works for both client- and server-side rendering, and has a strict but flexible API.
MIT License
320 stars 23 forks source link

Fix #11 - add support for objects passed to link #19

Open linkesch opened 8 years ago

linkesch commented 8 years ago

Add support for objects passed to link option which makes possible more advanced meta tags like:

<link rel="icon" type="image/png" sizes="32x32" href="/img/favicons/favicon-32x32.png">
<link rel="alternate" type="application/rss+xml" href="/foo/feed" />
<link rel="alternate" href="/url" hreflang="en-us" />

This PR is backwards compatible. You can still use the old format for simpler meta tags:

var meta = {
    link: {
        rel: {
            stylesheet: [
                'http://domain.tld/css/vendor.css',
                'http://domain.tld/css/styles.css'
            ]
        }
    }
};

But for more advanced you can use this:

var meta = {
    link: {
        rel: {
            alternate: [
                { href: '/alternate/us', hreflang: 'en-us' },
                { href: '/alternate/gb', hreflang: 'en-gb' }
            ]
        }
    }
};
linkesch commented 8 years ago

Fixes #11

danieljuhl commented 8 years ago

Thanks! I'll have a look.. One thing that I would like to test, is how changes is handled. What happens in nested cases? We need to make sure, that we are able to "remove" the old ones.

linkesch commented 8 years ago

Yes. Good thinking. You can consider this PR as a work in progress. I needed for my project at least basic support of alternate links. So I just extended the current behavior.

danieljuhl commented 8 years ago

Sounds great - I might contribute my self, I'm just trying to figure out, what would be the best approach.

NowTV-Assurance commented 8 years ago

Any movement on this?

danieljuhl commented 8 years ago

@NowTV-Assurance yes, there is movement on this. I've just made some core changes to react-document-meta. I'm working on another version to be released start of next week, which will support this and a few other cases.

tadjohnston commented 7 years ago

Any idea when this might be merged? Having the same issues and needing to add a media query to a link rel tag.

sahat commented 7 years ago

Any update on this pull request? I too need to pass a media query to alternate rel tag. Thanks!

stocks29 commented 7 years ago

Any thoughts on when we might see this released?

blling commented 6 years ago

Any plan of this?

Fluorz commented 5 years ago

I need this