Is there a way to exclude the featured image from rss feed {{content}} object?

I’m using latest Ghost 6.10.3 and I’m trying to customize my rss feed based on Official Ghost + Custom RSS Integration post. The challenge I have is that I want to exclude the feature post from showing up when the rss.hbs does:

    <content:encoded><![CDATA[ {{content}} ]]></content:encoded>

the reason for this is that I typically repeat the feature image as the last element of my posts to make them easily viewable in full without the mask/text at the top of the post. As a result in my rss feed it shows twice. Is there a way to unroll the {{content}} so that I can programmatically skip the featured image? or other good way to achieve this?

I would suggest to not repeat feature image inside your actual content, but do it in your theme (post.hbs, with an internal tag like #repeat-reature-image). Then you will not need to tune anything on RSS, Email or ActivityPub.

2 Likes

Good point, thanks, i’ll take that route

Thanks again! I implemented the change like suggested and it works great!

            <div class="post-content">
                {{content}}
            </div>
            {{!-- Add featured image after content unless #dont-duplicate-feature tag is used --}}
            {{^has tag="#dont-duplicate-feature"}}
                {{#if feature_image}}
                    <figure class="kg-card kg-image-card kg-width-wide">
                        <img
                            srcset="{{img_url feature_image size="xs"}} 300w, {{img_url feature_image size="s" }} 600w, {{img_url feature_image size="m" }} 800w, {{img_url feature_image size="l" }} 1200w, {{img_url feature_image size="xl" }} 1600w, {{img_url feature_image size="xxl" }} 2000w"
                            sizes="(min-width: 1600px) 1600px, 100vw"
                            src="{{img_url feature_image size="xl"}}"
                            alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}"
                        />
                        {{#if feature_image_caption}}
                            <figcaption>{{feature_image_caption}}</figcaption>
                        {{/if}}
                    </figure>
                {{/if}}
            {{/has}}
2 Likes