oferwald / transposh

Repository for Transposh git
GNU General Public License v3.0
13 stars 6 forks source link

Inclusion of ALL page versions (including "self") in hreflang #14

Open dleigh opened 1 year ago

dleigh commented 1 year ago

Hello Ofer, According to this page: https://developers.google.com/search/docs/specialty/international/localized-versions and other things I'm seeing, the hreflang tag should also exist for the current page and not only for the OTHER language versions. So with 3, languages: nl, en, vi for example, every page that is translated (let's assume all of them) should have 3 hreflang tags.

Apparently it was Google that invented the hreflang tag in 2011, so I'll assume that they are the ones to establish the correct practice. Consequently, it would appear that the Transposh implementation is incomplete or in error on this point.

There is also the idea of the "x-default" hreflang tag. Its inclusion appears to be optional, and its purpose is a bit more subtle (and confusing), but it seems like there should be an option to create it. Thanks

dleigh commented 1 year ago

In transposh.php, this appears to be the modification necessary to include a "self" hreflang tag:

` /**

` Basically just commenting out the if statement checking to see if it's the "active" page and including it instead of excluding it. If we want to change the way it functions to ALWAYS include the "self" hreflang tag it's pretty straightforward. If it needs to be optional (which makes sense for backwards compatibility with how Transposh has always functioned) then, of course it's a bit more effort to make it a parameter.