Skip to content

🐛 Fixed missing feature images for published posts in Contributor posts list#26726

Merged
kevinansfield merged 1 commit intomainfrom
claude/fix-dark-mode-posts-0MxEL
Mar 10, 2026
Merged

🐛 Fixed missing feature images for published posts in Contributor posts list#26726
kevinansfield merged 1 commit intomainfrom
claude/fix-dark-mode-posts-0MxEL

Conversation

@kevinansfield
Copy link
Member

@kevinansfield kevinansfield commented Mar 6, 2026

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.

  • Updates the feature image container to use a background image when @post.featureImage is available
  • Only displays the placeholder SVG icon when no feature image exists
  • Uses inline styles with html-safe to apply the background image URL dynamically

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
@kevinansfield kevinansfield changed the title Display feature images in posts list analytics view 🐛 Fixed missing feature images for published posts in Contributor posts list Mar 6, 2026
@kevinansfield kevinansfield marked this pull request as ready for review March 10, 2026 10:02
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 10, 2026

Walkthrough

The 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)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing missing feature images in the posts list for contributors, which matches the core functionality update in the changeset.
Description check ✅ Passed The description is directly related to the changeset, explaining the problem being solved and the implementation approach using background images and conditional placeholders.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-dark-mode-posts-0MxEL

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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.featureImage is falsy, the style becomes background-image: url(); which is technically invalid CSS, though browsers handle it gracefully. An optional refinement would be to conditionally apply the style only when featureImage exists:

💡 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

📥 Commits

Reviewing files that changed from the base of the PR and between 1742cd0 and c486db9.

📒 Files selected for processing (1)
  • ghost/admin/app/components/posts-list/list-item-analytics.hbs

@kevinansfield kevinansfield merged commit 292bdc3 into main Mar 10, 2026
30 checks passed
@kevinansfield kevinansfield deleted the claude/fix-dark-mode-posts-0MxEL branch March 10, 2026 10:10
peterzimon pushed a commit that referenced this pull request Mar 10, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants