-
Notifications
You must be signed in to change notification settings - Fork 660
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 itemProp attributes for meta tag, titleAttributes for title #169
Conversation
…tributes for meta to support SEO
When is this going to get merged? |
Is there a plan for this to be merged soon? |
Thanks for the PR and your patience. I will actively work on getting this into the codebase asap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Thanks for the PR.
@@ -273,6 +295,10 @@ const generateTagsAsString = (type, tags) => { | |||
} | |||
|
|||
const encodedValue = encodeSpecialCharacters(tag[attribute]); | |||
// itemProp in react is camelcase, but will generate as lowercase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API should be html key itemprop
as you would expect to see it in the DOM. It will just pass-through in this function.
Object.keys(attributes).forEach((attribute) => { | ||
props[attribute] = attributes[attribute]; | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would do a conversion here using REACT_TAG_MAP
to convert itemprop
to itemProp
@@ -368,6 +399,7 @@ const Helmet = (Component) => { | |||
* @param {String} title: "Title" | |||
* @param {String} defaultTitle: "Default Title" | |||
* @param {String} titleTemplate: "MySite.com - %s" | |||
* @param {Object} titleAttributes: {"itemProp": "name"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
itemprop
@cwelch5 Updated. |
Thx @dattran92 for your patience. Will publish soon. |
Supporting issue #113.
Usage:
<Helmet meta={[{'itemProp': 'image', 'content': 'some_url_here'}]} />
<Helmet title="Your title" titleAttributes={{itemProp: 'name'}} />