diff --git a/_includes/layouts/post.njk b/_includes/layouts/post.njk index 74a0512..3de01c5 100644 --- a/_includes/layouts/post.njk +++ b/_includes/layouts/post.njk @@ -93,7 +93,17 @@ withBlogSidebar: true {# JSON-LD Structured Data for SEO #} - {% set postImage = photo or image or (content | extractFirstImage) %} + {# Handle photo as potentially an array #} + {% set postImage = photo %} + {% if postImage %} + {# If photo is an array, use first element (check if first element looks like a URL) #} + {% if postImage[0] and (postImage[0] | length) > 10 %} + {% set postImage = postImage[0] %} + {% endif %} + {% endif %} + {% if not postImage or postImage == "" %} + {% set postImage = image or (content | extractFirstImage) %} + {% endif %} {% set postDesc = description | default(content | ogDescription(160)) %}