mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-15 23:18:51 +02:00
fix: handle empty/undefined images in feeds
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ eleventyExcludeFromCollections: true
|
||||
"title": {{ post.data.title | default(post.content | striptags | truncate(80)) | jsonEncode | safe }},
|
||||
"content_html": {{ post.content | htmlToAbsoluteUrls(absolutePostUrl) | jsonEncode | safe }},
|
||||
"date_published": "{{ post.date | dateToRfc3339 }}"
|
||||
{%- if postImage %},
|
||||
{%- if postImage and postImage != "" %},
|
||||
"image": "{{ postImage | url | absoluteUrl(site.url) }}"
|
||||
{%- endif %}
|
||||
}{% if not loop.last %},{% endif %}
|
||||
|
||||
@@ -20,7 +20,7 @@ eleventyExcludeFromCollections: true
|
||||
<guid isPermaLink="true">{{ absolutePostUrl }}</guid>
|
||||
<pubDate>{{ post.date | dateToRfc822 }}</pubDate>
|
||||
<description>{{ post.content | htmlToAbsoluteUrls(absolutePostUrl) | escape }}</description>
|
||||
{%- if postImage %}
|
||||
{%- if postImage and postImage != "" %}
|
||||
{%- set imageUrl = postImage | url | absoluteUrl(site.url) %}
|
||||
<enclosure url="{{ imageUrl }}" type="image/jpeg" length="0"/>
|
||||
<media:content url="{{ imageUrl }}" medium="image"/>
|
||||
|
||||
Reference in New Issue
Block a user