-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hreflang link tags #54
Conversation
I made a couple of quick edits so it runs in local testing without GlotPress installed.
return strcasecmp( $a->hreflang, $b->hreflang ); | ||
} ); | ||
|
||
wp_cache_set( 'local-sites', $sites, 'locale-associations' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about making the cache_set conditional on count( $sites ) > 2
so my local testing bypass can't poison the cache in production if it somehow executed the wrong code path.
|
||
foreach ( $sites as $site ) { | ||
$url = sprintf( | ||
'https://%swordpress.org%s', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we don't really care that this will reference wordpress.org
as the hreflang when it's being used locally, so I see no problem keeping the production domain here.
Thanks @dd32
I think this is good to go now but let's wait till after the DC review. |
This is basically a straight port of the
hreflang_link_attributes
function from thewporg
theme.I made a couple of quick edits so it runs in local testing without GlotPress installed.
Fixes #43.
Props @dd32.
How to test the changes in this Pull Request:
<link rel="alternate" href="..." hreflang="..">
elements.