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.
This commit is contained in:
@@ -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 %}
|
||||
}
|
||||
</script>
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user