ethercreative / seo

SEO utilities including a unique field type, sitemap & redirect manager
MIT License
269 stars 96 forks source link

URL is shown twice in snippet preview #464

Open niektenhoopen opened 11 months ago

niektenhoopen commented 11 months ago

On a multi-site installation, the URL is shown incorrectly in the preview snippet in the CP.

Example:

When visiting the CP under default-domain.com/admin, navigating to the content of the second domain under "Entries", the URL in the SEO optimization preview snippet (the one with the SEO title and meta description) is displayed as: https://default-domain.com/https://second-domain.com/about-us

Versions:

niektenhoopen commented 11 months ago

@Tam I see there was an attempt to fix this 2 years ago in PR #464. I might be able to come up with a (new?) PR but I don't understand what this piece of code should actually do: https://github.com/ethercreative/seo/blame/dc9fa7f47bb5e542afe2f7c7f8d09f047c55ce4c/src/templates/_seo/fieldtype.twig#L116 Can you help?

FreekVR commented 7 months ago

We're also (still) facing this issue. It seems the siteUrl passed to the seo snippet is pointing to the default site. While the url of the entry contains the correct domain, which is then not being replaced by an empty string as it doesn't match.

It seems the Craft multisite dropdown is not setting the currentSite used by the SEO plugin, at least not at that point in code execution.