Skip to content

fix(social-icons): add Google News icon and domain mapping#2690

Open
faisalahammad wants to merge 2 commits into
Automattic:trunkfrom
faisalahammad:fix/2213-google-news-icon
Open

fix(social-icons): add Google News icon and domain mapping#2690
faisalahammad wants to merge 2 commits into
Automattic:trunkfrom
faisalahammad:fix/2213-google-news-icon

Conversation

@faisalahammad
Copy link
Copy Markdown
Contributor

@faisalahammad faisalahammad commented May 6, 2026

Summary

Adds a dedicated Google News social icon and domain mapping so news.google.com URLs in the social menu display the correct icon instead of falling back to the generic Google logo or chain-link icon.

Fixes #2213

Changes

newspack-theme/classes/class-newspack-svg-icons.php

Before: No google-news mapping or SVG existed. news.google.com URLs received no match, falling through to the generic link icon.

After: Added google-news entry to both $social_icons_map and $social_icons arrays:

  • Domain mapping: news.google.com
  • SVG: Newspaper-style icon matching the Google News brand

Why: Follows existing patterns — apple-news is similarly distinct from apple. The Google News icon is visually different from the generic Google "G" logo.

Testing

Test: Google News menu link

  1. Open Appearance → Menus → Social Links Menu
  2. Add a custom link with URL https://news.google.com/publications/...
  3. Save and view frontend
  4. Confirm the link shows a newspaper icon, not the Google "G" or chain-link

@faisalahammad faisalahammad requested a review from a team as a code owner May 6, 2026 06:31
@laurelfulford laurelfulford added the [Status] Needs Review The issue or pull request needs to be reviewed label May 12, 2026
Copy link
Copy Markdown
Contributor

@laurelfulford laurelfulford left a comment

Choose a reason for hiding this comment

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

Thanks for taking a swing at this one, @faisalahammad!

I added a bit of feedback in a code comment.

Also I'm not sure if this is what you intended to load as an icon (on the left):

Image

This is what Google News has for its official icon - it's pretty big and busy compared to the other icons used in the social links menu, so I get why it wasn't the first choice! As a middle ground, what do you think about explicitly assigning the Google icon (the G in the screenshot above) to news.google.com? That way it won't load the link icon, but will be recognizable as Google and still fit in?

<svg viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M8,11h6.61c0.06,0.35,0.11,0.7,0.11,1.16c0,4-2.68,6.84-6.72,6.84c-3.87,0-7-3.13-7-7s3.13-7,7-7 c1.89,0,3.47,0.69,4.69,1.83l-1.9,1.83C10.27,8.16,9.36,7.58,8,7.58c-2.39,0-4.34,1.98-4.34,4.42S5.61,16.42,8,16.42 c2.77,0,3.81-1.99,3.97-3.02H8V11L8,11z M23,11h-2V9h-2v2h-2v2h2v2h2v-2h2"></path>
</svg>',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Given how the SVGs are read, the icon for Google is getting picked up first for Google News. The quickest way to fix would be to move the icon here, before 'Google'.

@laurelfulford laurelfulford added the [Status] Needs Changes or Feeback The issue or pull request needs action from the original creator label May 12, 2026
Add google-news social icon SVG and domain mapping for news.google.com.
Currently, Google News links in the social menu fall back to the generic
Google logo or the chain-link icon. This adds a dedicated newspaper-style
icon matching the Google News brand. Also ensures the icon is matched
before the generic Google icon.

Fixes Automattic#2213
@faisalahammad faisalahammad force-pushed the fix/2213-google-news-icon branch from a1af4b3 to 289f5c2 Compare May 13, 2026 15:48
@faisalahammad
Copy link
Copy Markdown
Contributor Author

Hi @laurelfulford,

Thanks for the catch! I've updated the PR and moved the google-news entry before google in the $social_icons array so it takes precedence during the regex loop.

I've also squashed the commits and cleaned up the commit message.

'feed' => array(
'/feed',
),
'google-news' => array(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, I didn't explain this change very well, @faisalahammad!

If there are cases where the fallback link icon is used for Google News (as mentioned in the issue description), then that URL and google.com could be mapped directly to the google icon, similar to how it's done for the apple icon:

		'google' => array(
			'google.com',
			'news.google.com',
		),

However, I couldn't recreate this exact issue myself -- when I added a news.google.com URL to the social links menu, the G icon was already being used on trunk.

It should just be falling back to the Google icon because it's a subdomain of google.com, but let me know if you have steps to recreate the link icon being used! If not, I don't think we need to make any changes to the code since we're using the same SVG.

Just let me know if that doesn't make sense! 🙂

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @laurelfulford, thanks for the detailed feedback! 🙏

I've updated the approach based on your notes:

  1. Removed the standalone google-news map entry (which was dead code without a corresponding SVG)
  2. Added an explicit google map entry with both google.com and news.google.com, so the mapping is intentional rather than relying on the TLD fallback

This is the minimal fix you suggested in your second comment. Ready for another look whenever you have time!

Replace standalone google-news entry with explicit google map that
includes both google.com and news.google.com. Maintainer confirmed
google icon already resolves for news.google.com via TLD fallback;
this makes the mapping explicit per review feedback.
@faisalahammad faisalahammad force-pushed the fix/2213-google-news-icon branch from 55c7f99 to bc726d0 Compare May 24, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] Needs Changes or Feeback The issue or pull request needs action from the original creator [Status] Needs Review The issue or pull request needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use correct icon for Google news

2 participants