transifex / transifex-live-wordpress

Wordpress plugin for Transifex Live
https://wordpress.org/plugins/transifex-live-integration/
Other
7 stars 9 forks source link

Feature Request - Optional hreflang integration #172

Open JayHoltslander opened 7 years ago

JayHoltslander commented 7 years ago

It would be nice if the option to use or not use alternate hreflang was available as an on/off selection within the plugin's settings.

On this page "How To Make Sitemaps In Multiple Languages With WordPress" it reads...

According to Google you can indicate that the French URL is equivalent of the English page using hreflang attributes basically in two ways:

A. HTML link in header … B. Sitemap …

IMPORTANT: Google recommends choosing only one way to implement hreflang annotations, in order to avoid errors.

So it would seem that things are currently set up fine by Transifex. HOWEVER, we would prefer to utilize multilingual sitemaps over the hreflang in the head method.

Justifications:

Currently we can disable it within includes/lib/transifex-live-integration-hreflang.php by commenting out lines 114-138 but that will be undone by the next plugin update.

Aside: Yoast SEO doesn't have support for building multilingual sitemaps. They need to be generated with another tool like Dynomapper (Which does detect Transifex' multilingual pages and builds a sitemap including them.)

matthewjackowski commented 7 years ago

So the current logic adds hreflangs if you enable the 'rewrite' logic in the UI. However a specific toggle to control this was added to the config, but not enforced (see https://github.com/transifex/transifex-live-wordpress/blob/9229557b31373784225f57ff53fffc3f4ab8aaf9/includes/transifex-live-integration-defaults.php#L118)

I don't remember why I pulled it out specifically (maybe because hreflangs are only able to properly generate if you are using the rewrite logic, so why not just always do it if you can), but it should be a simple change to also add a logic check for that setting without commenting the render code in includes/lib/transifex-live-integration-hreflang.php

Unfortunately adding a control for this in the admin UI is considerably less simple.