From 401ed70d37abc6877e4837a13ded07c97eba7e94 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 23 May 2023 09:41:45 -0700 Subject: [PATCH] fix: post images --- config/filters.js | 7 ++----- src/_includes/base.liquid | 10 +++++----- src/posts/posts.11tydata.js | 3 ++- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/config/filters.js b/config/filters.js index 2b5c17f7..62bd5989 100644 --- a/config/filters.js +++ b/config/filters.js @@ -15,11 +15,8 @@ module.exports = { mdToHtml: (content) => { return marked.parse(content) }, - getPostImage: (post) => { - if (post && post['image'] && post['image'] !== '') { - return post['image'] - } - + getPostImage: (image) => { + if (image && image !== '') return image return '/assets/img/social-card.png' }, webmentionsByUrl: (webmentions, url) => { diff --git a/src/_includes/base.liquid b/src/_includes/base.liquid index 7f163229..0f2ace9f 100644 --- a/src/_includes/base.liquid +++ b/src/_includes/base.liquid @@ -1,5 +1,5 @@ +{%- capture fullUrl %}{{ site.url }}{{ page.url }}{% endcapture -%} - @@ -9,13 +9,13 @@ {{ site.title }} - + - - + + striptags(md.render(data.post_excerpt)), url: (data) => data.url, image: { - src: '/assets/img/social-card.png', + src: (data) => data.image | getPostImage, }, author: { name: 'Cory Dransfeldt',