I have a content type called "article" that I've given a "featured image" field, which I'm using for the og:image metatag by using the [node:field_featuredimage] token. However, not all of my nodes of my "article" content type have a featured image.
For articles that have a featured image, the og:image metatag is printed correctly.
For articles that have an empty field_featuredimage, no og:image metatag is printed at all, presumably because getValue returns nothing when expanding the token.
I have a default og:image set for all content types, and I'd like articles with an empty field_featuredimage to display the default image I've set instead of displaying no tag at all.
Is this behaving as designed or is it a bug? Or should this be a feature request?
Comments
Comment #1
Nightwalker3000 commentedSame issue here. Did you find a solution?
Comment #2
hawkeye217 commentedMy solution is kind of a hack, but it works. I added this in my mytheme_preprocess_html() in template.php:
I also added this function to template.php, which as an alter function runs after the metatags module inserts its code - it just checks to see if metatag has added an og_image, and if it has, it removes my default that my preprocess function added:
Hope that helps!
Comment #3
damienmckennaThis should work with the latest codebase, please let me know if you're experiencing problems with it.
Comment #4
damienmckennaComment #5
ibedoya commentedI still have this problem. Also with an image and og:image.
I have the default 'field_image' for 'Article' content type.
I put a defaut image for 'Global'. Also I've tried to set a default image for 'Content'(node).
In both cases when I don't put the image, the default image isn't used.
In wich commit was fixed?
Comment #6
damienmckennaFor any issues with beta4 please focus on #1845326: Metatags not loading correctly with beta4. Thank you.