sybrew / the-seo-framework

The SEO Framework WordPress plugin.
https://theseoframework.com/
GNU General Public License v3.0
420 stars 46 forks source link

Wrong og:url on Multilingual Content (Using Polylang) #392

Closed black-eye closed 5 years ago

black-eye commented 5 years ago

Hi,

see page here: https://shaktiqueen.blackeye.cz/en/ The og:url points out to https://shaktiqueen.blackeye.cz and thus (propably) when sharing the page on FB it shows the text in the wrong language (default one).

Just for the reference, the same problem isn't present neither in Yoast (http://demo.remedical.cz/en/) nor in SEOPress (https://www.playday.cz/en/), so I suppose it's a bug, not an intention.

Thanks

black-eye commented 5 years ago

Hm, just an addiction: it seems, that the problem is specific for the Home page only, subpages (e.g. https://shaktiqueen.blackeye.cz/en/birthing-the-goddess/) are fine.

sybrew commented 5 years ago

Duplicate: #325

Polylang doesn't adjust WordPress' home URL. Instead, they change the site URL. This change is incorrect, and only they can resolve it.

Unfortunately, their whole software package is built around this fact, and a big rewrite needs to take place to resolve this.

They do have monkey patches in place for themes and Yoast.

SEOPress uses the HTTP request, and it's therefore not a real canonical URL. You can add anything to a page, as long as WordPress accepts it, and it'll be used as the canonical URL. It is therefore also prone to negative SEO attacks.

The only solution would be to fill in a custom canonical URL for the translated homepage, but it has to be a page, not a blog. This value can be set at /wp-admin/options-reading.php. Then, you can set the canonical URL when editing the page itself, within the SEO Settings meta box at the bottom.

black-eye commented 5 years ago

@sybrew Thanks for the tip, the canonical URL in SEO Settings did the trick.

Strangely enough, the right address (/en) was there prefilled as a placeholder, but only after filling it regularly, it took the effect on the frontend.

sybrew commented 5 years ago

Yes, that's part of their monkey patch 😄, this is a good sign, thanks for highlighting it!

I'll see if I can send Polylang a PR that fixes this in wp_head (where TSF outputs its metadata), rather than in the body and on the admin pages.

MikeiLL commented 5 years ago

I don't see which setting is being referred to on the /wp-admin/options-reading.php page:

The only solution would be to fill in a custom canonical URL for the translated homepage, but it has to be a page, not a blog. This value can be set at /wp-admin/options-reading.php.

UPDATE: Oh! You mean that on the /wp-admin/options-reading.php page is the configuration to set the home page to be a page as opposed to blog feed.

I did, "set the canonical URL when editing the page itself, within the SEO Settings meta box at the bottom."

When the URL was set to https://example.com/es/page-title-en-espanol it created a redirect loop:

Input URL | -> | https://example.com/es/page-title-en-espanol/ 301 HTTP Redirect | -> | https://example.com/es/page-title-en-espanol/

This is, I think, because Polylang creates a redirect.

So the Canonical URL needs to be like: https://example.com/page-title-en-espanol.

Now the correct og tags are being read. As is the correct title.