🐛 Fixed missing feature images for published posts in Contributor posts list#26726
🐛 Fixed missing feature images for published posts in Contributor posts list#26726kevinansfield merged 1 commit intomainfrom
Conversation
The contributor view for published posts was always showing a placeholder instead of the actual feature image. This made the feature image div match the non-contributor branch which correctly sets background-image. https://claude.ai/code/session_01BApTXnYYp6Jtm4mcB84g1V
WalkthroughThe posts-list list-item-analytics component template has been updated to modify feature image rendering. The static empty placeholder has been replaced with dynamic background-image styling that uses the post's featureImage URL when available. A conditional placeholder element renders an SVG only if no featureImage is provided. These changes apply to both locations within the template where feature images are displayed. The modification adds 6 lines and removes 2 lines of code. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
ghost/admin/app/components/posts-list/list-item-analytics.hbs (1)
12-17: LGTM! Fix correctly aligns contributor view with non-contributor view.The change properly shows the feature image when available and falls back to the placeholder SVG when not. This matches the existing pattern at lines 61-67.
Minor observation: when
@post.featureImageis falsy, the style becomesbackground-image: url();which is technically invalid CSS, though browsers handle it gracefully. An optional refinement would be to conditionally apply the style only whenfeatureImageexists:💡 Optional improvement
- <div class="gh-post-list-feature-image" style={{html-safe (concat "background-image: url(" `@post.featureImage` ");")}}> + <div class="gh-post-list-feature-image" style={{if `@post.featureImage` (html-safe (concat "background-image: url(" `@post.featureImage` ");"))}}>This same pattern could also be applied to line 61 for consistency.
,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@ghost/admin/app/components/posts-list/list-item-analytics.hbs` around lines 12 - 17, The inline style always renders background-image: url(); when `@post.featureImage` is falsy—produce invalid CSS; change the template so the style attribute on the gh-post-list-feature-image element is only added when `@post.featureImage` is truthy (e.g., wrap the html-safe concat in a conditional or render the style attribute via a sub-expression only when `@post.featureImage` exists), and apply the same conditional pattern to the other gh-post-list-feature-image instance so both contributor and non-contributor views behave consistently.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@ghost/admin/app/components/posts-list/list-item-analytics.hbs`:
- Around line 12-17: The inline style always renders background-image: url();
when `@post.featureImage` is falsy—produce invalid CSS; change the template so the
style attribute on the gh-post-list-feature-image element is only added when
`@post.featureImage` is truthy (e.g., wrap the html-safe concat in a conditional
or render the style attribute via a sub-expression only when `@post.featureImage`
exists), and apply the same conditional pattern to the other
gh-post-list-feature-image instance so both contributor and non-contributor
views behave consistently.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f368a3dc-f275-44b1-a1b4-d498f2f2f114
📒 Files selected for processing (1)
ghost/admin/app/components/posts-list/list-item-analytics.hbs
…ts list (#26726) ref https://linear.app/ghost/issue/ONC-1512/ The template for the posts list only contained feature image display for drafts. - matched published feature image template to the draft template image
ref https://linear.app/ghost/issue/ONC-1512/
The posts list analytics view currently shows a placeholder for all posts, regardless of whether they have a feature image. This change improves the visual presentation by displaying actual feature images when available.
@post.featureImageis availablehtml-safeto apply the background image URL dynamically