Hi everyone,
I’ve been debugging this issue for quite a while and finally reduced it to what I believe is a minimal reproducible example.
Environment
- Ghost(Pro)
- Ghost 6.x
- Custom theme based on Starter/Casper
My homepage is configured through routes.yaml like this:
routes:
/:
template: page
data: page.enter
collections:
/blog/:
permalink: /{slug}/
template: index
taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
The Page with slug enter has:
- a Feature Image assigned
- “Show title and feature image” enabled
Inside page.hbs I’m using the standard Ghost wrapper:
{{#post}}
<p>Title: {{title}}</p>
<p>Slug: {{slug}}</p>
<p>URL: {{url}}</p>
<p>ID: {{id}}</p>
{{#if feature_image}}
<p>Feature image EXISTS</p>
{{else}}
<p>Feature image MISSING</p>
{{/if}}
<img src="{{img_url feature_image}}" />
{{/post}}
Results
Everything below resolves correctly:
title
slug
url(/enter/)
id(correct Page ID)
However:
feature_imageis alwaysnull
{{img_url feature_image}}outputs nothing
Things already verified
- The Feature Image is definitely assigned.
- “Show title and feature image” is ON.
- The correct Page is being loaded (confirmed by title, slug, URL and ID).
routes.yamlis active and working./enter/correctly redirects to/because the page is used as the homepage.- I also tested replacing
{{#post}}with{{#page}}after reading a suggestion elsewhere, but Ghost rejects the theme because{{#page}}is not a valid Handlebars helper.
My question
Is it expected that feature_image is unavailable when a Page is rendered through:
routes:
/:
data: page.enter
or does this indicate a bug/regression?
If this is expected behavior, what is the correct way to access the Page’s Feature Image in this routing setup?
I’m happy to test anything on my Ghost(Pro) instance if someone can point me in the right direction.
Thanks!