Add various conditions to the post.hbs file for feature_image

Hello everyone. I’m using the latest version of Ghost available on my VPS, ubuntu system.

I wanted to try to add some condition for the feature image, in order to save local disk space.
I wanted to make sure that if the feature image is not set in the post, then the first image in the html page that has this id: “this_featured” is taken as the feature image.

What code can I use in the post.hbs file to add this condition?
This is the original code of the “Solo” theme which is in the gh-content gh-canvas section:

{{#unless feature_image}}
                        <header class="gh-article-header">
                            <h1 class="gh-article-title">{{title}}</h1>
                            {{#if custom_excerpt}}
                                <p class="gh-article-excerpt">{{custom_excerpt}}</p>
                            {{/if}}
                        </header>
                    {{/unless}}

This isn’t something that can be done via the theme layer, because the theme layer doesn’t parse your content or have any knowledge of it.

While images can certainly take up disk space, I’m not sure how much this optimization will help. Are you running out of disk space on your VPS?

Not yet. But being a photography portfolio site, I’m sure I’ll hit the limit and wanted to not load the vps storage. this would also allow me to host other Ghost clients and have more space available.

I think the ability to indicate a link in the feature image is very useful.