Problem/Motivation
I would like to create some custom meta tags for DataCite. I went to the Add Custom tag page @ /admin/config/search/metatag/custom-tags/add but not sure which drop-down option to choose for the 3 fields (HTML element, Name attribute, Value attribute). For example,
- what do "Meta" and "Link" mean for the HTML field?
- what is the difference between "Name", "Property" and "Item Prop" for the Name attribute field and what do "Http equiv" and "Rel" mean?
- what do the "Content" and "Href" choice mean for the Value attribute field?
- how do i specify which content field to use for the value?
- if a field i want to map to allows multiple input, how to configure that?
Proposed resolution
Perhaps add info about the custom tag configuration to the documentation page
Complete List of HTML Meta tags https://gist.github.com/whitingx/3840905
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | custom_tag.jpg | 176.58 KB | gillesbailleux |
| #4 | icon_custom_tag.jpg | 71.01 KB | gillesbailleux |
Issue fork metatag-3488276
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
naveenvalechaHere's a blog post https://www.morpht.com/blog/unleashing-power-metatag-custom-tags which would help you.
I'll write a drupal org handbook page for custom tags
Comment #3
monaw commentedthank you @naveenvalecha!
Comment #4
gillesbailleuxGreetings,
@naveenvalecha's blog post begins with an example of a custom meta tag:
<link rel="alternate" type="application/rss+xml" href="https://example.com/rss.xml">The blog post continues with a custom meta tag added through the metatag_custom_tags module:
<meta name="sitename" content="Custom Meta Tag - Demo Site">To my understanding, the metatag_custom_tags module currently allows two attributes and not three as mentioned in the first example.
Here is the custom meta tag I would like to create:
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />Here are the informations implemented in /admin/config/search/metatag/custom-tags/icon:
Adding the value /favicon.svg in the custom tags field, this generates the following custom tag:
<meta rel="icon" href="/favicon.svg" />How do I add the type="image/svg+xml" attribute in the custom tags field? Not with a comma because this generates two custom tags. Neither with a pipe: I tried numerous possibilities and none worked.
Please tell me how to add the type="image/svg+xml" attribute. Thank you.
Comment #5
naveenvalecha@gillesbailleux
The Custom Meta tags is designed to support the single html attribute.
I have updated the blog post to reflect that https://www.morpht.com/blog/unleashing-power-metatag-custom-tags
I have also updated the issue title and description and converted it to a feature request to seek @damienmckenna thoughts and approval on it before doing the code changes.
Comment #6
naveenvalechaComment #7
gillesbailleuxThank you @naveenvalecha
Comment #8
damienmckennaThis would be a great feature improvement for 2.2.x
Comment #10
naveenvalecha@damienmckenna
Could I get your feedback on the post update hook
Comment #11
musa.thomashello there i come from this issue https://www.drupal.org/project/metatag/issues/3498656 but it seems not to be integrate here. Also we need to insert colon inside the tag name (the regex become 'replace_pattern' => '[^a-z0-9_-:]+',)
Comment #12
naveenvalecha@musa.thomas Thanks for your comment. Would you care to provide which metatag are you trying to create i.e. output
Example
Have you tried out this PR?
Comment #13
damienmckennaComment #14
naveenvalechaComment #15
damienmckennaThank you for working on this, it will be a great improvement once it's finished.
Testing this locally I see some issues:
So it still needs a little work but is almost there.
Comment #16
maeglinThe existing practice of making a custom tag's name attribute the same as the machine name is also a limitation. No colon characters allowed, for example. Maybe the machine name could be the default if a tag name isn't specified in the definition?
Comment #17
damienmckennaNote: I missed that there is an update script that adds an initial attribute for each custom tag already in the system, apologies for my oversight and thank you for taking care of that already.
The other issues still remain though.
Comment #19
eleonelThanks damienmckenna and maeglin for the feedback, I pushed some fixes and small improvements.
Comment #26
damienmckennaThank you for the improvements.
I recreated the MR from scratch against the 2.2.x branch, just waiting for the tests to finish.
Comment #28
damienmckennaThis has been committed. Thank you all!