fix(social-icons): add Google News icon and domain mapping#2690
fix(social-icons): add Google News icon and domain mapping#2690faisalahammad wants to merge 2 commits into
Conversation
laurelfulford
left a comment
There was a problem hiding this comment.
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):
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>', | ||
|
|
There was a problem hiding this comment.
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'.
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
a1af4b3 to
289f5c2
Compare
|
Hi @laurelfulford, Thanks for the catch! I've updated the PR and moved the I've also squashed the commits and cleaned up the commit message. |
| 'feed' => array( | ||
| '/feed', | ||
| ), | ||
| 'google-news' => array( |
There was a problem hiding this comment.
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! 🙂
There was a problem hiding this comment.
Hi @laurelfulford, thanks for the detailed feedback! 🙏
I've updated the approach based on your notes:
- Removed the standalone
google-newsmap entry (which was dead code without a corresponding SVG) - Added an explicit
googlemap entry with bothgoogle.comandnews.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.
55c7f99 to
bc726d0
Compare
Summary
Adds a dedicated Google News social icon and domain mapping so
news.google.comURLs 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.phpBefore: No
google-newsmapping or SVG existed.news.google.comURLs received no match, falling through to the genericlinkicon.After: Added
google-newsentry to both$social_icons_mapand$social_iconsarrays:news.google.comWhy: Follows existing patterns —
apple-newsis similarly distinct fromapple. The Google News icon is visually different from the generic Google "G" logo.Testing
Test: Google News menu link
https://news.google.com/publications/...