Skip to content
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

Add an option for custom attributes to link and meta tags #11

Open
sompylasar opened this issue Nov 14, 2015 · 8 comments
Open

Add an option for custom attributes to link and meta tags #11

sompylasar opened this issue Nov 14, 2015 · 8 comments
Assignees

Comments

@sompylasar
Copy link

For example, I cannot express the following tag

<link rel="icon" type="image/png" sizes="32x32" href="/img/favicons/favicon-32x32.png">

with the structured description:

{ link: { rel: { icon: '/img/favicons/favicon-32x32.png' } } }

as it would only render as:

<link rel="icon" href="/img/favicons/favicon-32x32.png">

The internal API is operating on arrays of tags with arbitrary number of attributes, but this API is not exposed, only the nested object with a limited level of nesting can be specified.

The API i'd prefer would be as follows:

{ link: [
  { rel: 'icon', href: '/img/favicons/favicon-32x32.png', type: 'image/png', sizes: '32x32' },
  { rel: 'icon', href: '/img/favicons/favicon-16x16.png', type: 'image/png', sizes: '16x16' },
] }

What do you think?

@danieljuhl
Copy link
Contributor

Definitely something we should be able to handle. I'm looking into several changes this weekend, and will see if we could implement a new API which handles these cases, and your suggestion could be the right one.

@danieljuhl danieljuhl self-assigned this Nov 14, 2015
@danieljuhl
Copy link
Contributor

The only thing I have against arrays, is the ability to efficiently merge nested definitions, with as little duplication as possible and still maintaining full control. An idea could be, to add a key to each object in an array, to be able to merge arrays when using nesting.

@sompylasar
Copy link
Author

Sure, adding a key is the React way of diffing lists.

@sheltonial
Copy link

This would also come in handy for specifying alternate content, such as an RSS feed.

<link rel="alternate" type="application/rss+xml" href="/foo/feed" />

@danieljuhl
Copy link
Contributor

I'm working on this right now... a new version should be out shortly...

@AlexYegupov
Copy link

Also it would be great to have the way to set this one:
<meta name="viewport" content="initial-scale=1.0, width=device-width">

@danieljuhl
Copy link
Contributor

@AlexYegupov
<DocumentMeta meta={{ name: { viewport: 'initial-scale=1.0, width=device-width' }}} />

@linkesch
Copy link

How does it look like with this feature? I would need a support of hreflang too:

<link rel="alternate" href="/url" hreflang="en-us" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants