Skip to content

Updated bookmark card favicon selection to prefer standard favicons#28768

Open
lujuldotcom wants to merge 1 commit into
TryGhost:mainfrom
lujuldotcom:fix/bookmark-card-favicon
Open

Updated bookmark card favicon selection to prefer standard favicons#28768
lujuldotcom wants to merge 1 commit into
TryGhost:mainfrom
lujuldotcom:fix/bookmark-card-favicon

Conversation

@lujuldotcom

Copy link
Copy Markdown
Contributor

Closes #28761

This change updates bookmark card favicon selection to prefer standard favicons before falling back to Apple Touch Icons.

The previous implementation explicitly prioritized apple-touch-icon entries with a width of at least 180px:

const appleTouchIcon = sizes.find(item => item.rel?.includes('apple') && item.sizes && item.size.width >= 180);
return appleTouchIcon || svgIcon || pickDefault(sizes);

As a result, bookmark cards could display an apple touch icon even when a site provided a dedicated favicon intended to represent its identity across browsers and platforms.

The updated implementation:

  • Prefers SVG favicons when available.
  • Uses the default favicon selection logic while excluding Apple Touch Icons.
  • Falls back to apple-touch-icon only when no standard favicon can be resolved.

This preserves support for Apple Touch Icons while allowing bookmark cards to better reflect the site's primary favicon.

@coderabbitai

coderabbitai Bot commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c0d94975-109f-40ef-9608-09e68b99ee30

📥 Commits

Reviewing files that changed from the base of the PR and between f32a14f and 7b3bbee.

📒 Files selected for processing (1)
  • ghost/core/core/server/services/oembed/oembed-service.js

Walkthrough

In oembed-service.js, the pickFn function used in fetchBookmarkData has its icon selection priority inverted. Previously, it checked for an Apple Touch icon (width ≥ 180) first, then an SVG icon, then the default selection. Now it filters Apple Touch icons out of the candidate set when searching for SVG and default icons, and only falls back to an Apple Touch icon if neither of those alternatives is available.

Suggested labels

needs:review

Suggested reviewers

  • rob-ghost
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: updating favicon selection to prefer standard favicons, which directly addresses the primary objective.
Description check ✅ Passed The description provides relevant context about the change, references the linked issue, and explains the new behavior and rationale.
Linked Issues check ✅ Passed The code changes implement all three suggested improvements: prioritizing SVG favicons, using default favicon selection logic while excluding Apple Touch Icons, and falling back to Apple Touch Icons only when needed.
Out of Scope Changes check ✅ Passed The changes are limited to the favicon selection logic in the pickFn function and directly address the requirements specified in issue #28761 with no extraneous modifications.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.

Bookmark cards prioritize apple-touch-icon over regular favicons

1 participant