There have been two issues recently (#2267501: Replace twitter:image with twitter:image:src, #2121437: Change from "Copyright" to "Rights" per w3c/whatwg metatag guidelines) where a meta tag was renamed. While it's simple to do an update script to update values in the {metatag} table, that does not resolve the problem that exported configurations will loose their existing values, i.e. the configurations for the old old meta tags will disappear. I suggest adding something like a 'replaces' value to the meta tag definition, which would ben an array containing the names of meta tags that were replaced by the current tag, so if settings for the old values were found they would be used as values for the new meta tag instead.

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new2.15 KB

Needs testing, but the general idea is that a tag defined via hook_metatag_info() would have an attribute named 'replaces' which would list either a single or multiple meta tags it would take the value of. Both the {metatag} and {metatag_config} items will be handled, which will hopefully make this relatively seamless. I've not tested this out yet, it's basically a prototype.

damienmckenna’s picture

StatusFileSize
new2.39 KB

After some testing, this appears to work rather nicely.

damienmckenna’s picture

StatusFileSize
new5.73 KB

This patch adds documentation for hook_metatag_info to metatag.api.php, which includes an explanation of the new 'replaces' value.

damienmckenna’s picture

Status: Needs review » Fixed

I've committed this.

  • DamienMcKenna committed 6a106cf on 7.x-1.x
    Issue #2298337 by DamienMcKenna: Added an API option to indicate one...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.