From dbd2f720196214e56dd3d1b1fc9281e08258053c Mon Sep 17 00:00:00 2001 From: Ricardo Date: Thu, 26 Feb 2026 14:56:13 +0100 Subject: [PATCH] fix: handle absolute URLs in JSON-LD image field When markdown images use full https:// URLs, the template was prepending site.url again, causing double-domain in structured data (e.g., https://rmendes.net/https://rmendes.net/media/...). Now checks if postImage starts with 'http' and skips the prefix. --- _includes/layouts/post.njk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_includes/layouts/post.njk b/_includes/layouts/post.njk index d1a2723..76ee848 100644 --- a/_includes/layouts/post.njk +++ b/_includes/layouts/post.njk @@ -242,7 +242,7 @@ withBlogSidebar: true } }, "description": {{ postDesc | dump | safe }}{% if postImage and postImage != "" and (postImage | length) > 10 %}, - "image": ["{{ site.url }}{% if '/' in postImage and postImage[0] == '/' %}{{ postImage }}{% else %}/{{ postImage }}{% endif %}"]{% endif %} + "image": ["{% if postImage.startsWith('http') %}{{ postImage }}{% elif '/' in postImage and postImage[0] == '/' %}{{ site.url }}{{ postImage }}{% else %}{{ site.url }}/{{ postImage }}{% endif %}"]{% endif %} }