Closed ghost closed 5 years ago
So as per http://ogp.me/#array, tags with multiple values are output separately (like duplicates, almost). This module isn't processing multiple values currently, so here's the code to make it do so (no PR sorry):
This https://github.com/backdrop-contrib/metatag/blob/1.x-1.x/metatag.module#L2079 needs to change to this:
else {
// Account for multi-valued tags.
if (!isset($data['#tag']) && !empty($data[0])) {
foreach($data as $delta => $subdata) {
backdrop_add_html_head($subdata, 'metatag_preprocess_page-' . $tag . '-' . $delta);
}
}
else {
backdrop_add_html_head($data, 'metatag_preprocess_page-' . $tag);
}
}
Ok, finally made a PR.
RTBC from me. I was trying to track down why I was getting empty tags in the header and it was due to an image field with more than one value. This was also giving these warnings in the log:
Notice: Undefined index: #tag in theme_head_tag() (line 2452 of /path/core/includes/theme.inc).
The PR above fixes it.
Nice, thanks to both of you!
I've just started using this module, but I noticed an issue when using a token for a multi-valued image field in the
og:image
tag. It output an empty tag (e.g.< />
) which actually displayed on the node (not pretty). Using a single-value field works properly though.I may be able to test this properly and/or provide more info later, but just starting this issue for now.