I am trying to populate the og:image meta tag. My template uses a fluid field (westeros_data) which has includes the ability to add single images or file grids of images. A post may have neither, either or both. If there’s neither, og:image gets no data (I am considering assigning a default image, however). If there’s either, og:image should get either the first single image or the first image from the grid. If there is both, og:image shoiuld get the first single image.
I have it working so it fetches the first single image:
{westeros_data}{westeros_data:westeros_image}{if {westeros_data:count name="westeros_image"} == "1"}{content}{content:image}{/content}{/if}{/westeros_data:westeros_image}
But I am not sure how to grab a single image from a file grid or to create a conditional in the case where a post has both a single image and a file grid with images.
Ah, figured out part of it. The limit = “1” parameter gets put on {content}. Next step, a conditional so it doesn’t fail when there’s both a standalone image and a slideshow.
You can check Texas Kitchen Hood Cleaning website for the same samples. And while at it, you can check the services in your area.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.