seo icon indicating copy to clipboard operation
seo copied to clipboard

URL is shown twice in snippet preview

Open niektenhoopen opened this issue 1 year ago • 2 comments

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

Example:

  • domain 1: https://default-domain.com/ (this is the {{ siteUrl }})
  • domain 2: https://second-domain.com/
  • page slug: about-us

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:

  • Craft Pro 4.5.10
  • SEO 4.2.1

niektenhoopen avatar Nov 14 '23 15:11 niektenhoopen

@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?

niektenhoopen avatar Nov 14 '23 15:11 niektenhoopen

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.

FreekVR avatar Feb 29 '24 12:02 FreekVR