I've a content type with some default value set, if the field Head title isn't filled on the node form. Pretty basic stuff, the node title plus site name [node:title] | [site:name], which is actually the default module configuration.
When viewing the node page, the <title></title> is empty. I've tracked this down to:
class DrupalTitleMetaTag extends DrupalTextMetaTag {
public function getElement(array $options = array()) {
xdebug_break();
$element = array();
$value = check_plain($this->getValue($options)); // Empty value returned, so default should apply no?
$element['#attached']['metatag_set_preprocess_variable'][] = array('html', 'head_title', $value);
$element['#attached']['metatag_set_preprocess_variable'][] = array('html', 'head_array', array('title' => $value));
return $element;
}
}
Of course, if I set a title on the node form meta tag vertical tab, it is working.
Any suggestion on why this could not work?
Thank you!
Comments
Comment #1
jchatard commentedOk, I've found the reason why my default Title tags (and some others) didn't appeared. My input fields, on node form were empty. So not matching the default pattern, like
[node:title]for example.So, I have two solutions, manually edit each concerned node, and reset all meta tags fields to their default configuration, which seems to be how the module works.
Or edit the module to consider that an empty field is like a default pattern.
But I'd like to have some info from the maintainer of the module, to know if this makes sense or not, as I can easily understand that an enpty value is not a default value.
For information, here's the patch that I applied to consider that an empty field is like requesting the default value.
Thanks,
Jérémy
Comment #2
damienmckennaI think expanding #1934492: Bulk operation for reverting meta tags to allow specific meta tags to be erased (rather than all) would be the best approach.