WordPress / wporg-main-2022

A block-based child theme for WordPress.org, plus local environment
65 stars 26 forks source link

Add hreflang tags #43

Closed tellyworth closed 2 years ago

tellyworth commented 2 years ago

The new pages need hreflang tags as a critical SEO requirement: https://wordpress.slack.com/archives/C02QB8GMM/p1659514993386139?thread_ts=1658956086.933959&cid=C02QB8GMM

The old front page used a static list. Some context on that: https://meta.trac.wordpress.org/ticket/5108

For other pages(?) it used this quirky code: https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/functions.php#L187

tellyworth commented 2 years ago

@dd32 am I correct in thinking that the right solution here is to port something along the lines of hreflang_link_attributes() into https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-seo/hreflang.php?

dd32 commented 2 years ago

dd32 am I correct in thinking that the right solution here is to port something

I guess so, but with the catch that it must only apply to themes using one of our parent themes and that have not unhooked it.. Although looking at which themes unhook it (learn, patterns, openverse) it might be safer to simply port this into the wporg-main-2022 theme.

tellyworth commented 2 years ago

Ah yeah I guess I was imagining it being unhooked by default, and only explicitly enabled by themes that need it.