From 0a0718c6b2074e81e063bfdb5da7c199cbf062c3 Mon Sep 17 00:00:00 2001 From: Ricardo Date: Wed, 28 Jan 2026 17:50:16 +0100 Subject: [PATCH] fix: handle photo array in post.njk JSON-LD The photo property can be an array for multi-photo posts. Also avoid calling startsWith on non-string values. Co-Authored-By: Claude Opus 4.5 --- _includes/layouts/post.njk | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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)) %}