Hi all. New to Ghost themes, so I’m hoping for a pointer or two. I don’t mind the coding part of my request, but I’m not sure where to start.
Essentially, the Edge theme is 95% what I need, but, occasionally, I want to post a text-only post without an image. I cannot tell which file to modify to conditionally show a post excerpt if there is no featured image. Any pointers or other suggestions re: how to proceed?
Start from home.hbs (if you don’t have a home.hbs, from index.hbs). There’s going to be a #foreach and inside it is the loop that puts the images on the screen. It might look something like {{>somefilename arguments=possible but=notalways}}. That’s called a partial, and you find it in partials/somefilename.hbs.
Once you find the code responsible, then you can think about modifying it. I’d check if the post has a featured image {{#if feature_image}} do current stuff {{else}} do new text-y stuff{{/if}}
Another option would be to tag those posts, and use the #has helper to check for the tag.
Ok, based on this, in the Edge theme, there is a ./partials directory containing loop.hbs. It contains an #if directive. Am I correct that there is no #elseif or #else companion to #if?
The theme currently tests for {{#if feature_image}} which does indeed exclude any post WITHOUT one. I’ve tried {{#unless feature_image}} after the if block for the alternate treatment, but that doesn’t seem to work (i.e., the test post I made with no feature image is not posting). `
Ok, great, got the {{else}} condition in place. I can see the post if I view source, so my assumption is that something in the CSS is my target. I’m curious if anyone has modified the built-in, Ghost-developed Edge theme to show text posts, or has pointers to any documentation of the Edge theme CSS that would help solve my use case.