seo
seo copied to clipboard
Problem with canonical
Description
Since the last update there were problems with canonical headers. On multisites with languages in the subdirectory the canons appear as "https://www.mywebsites.com/en/en/about-us". sometimes even the folder was repeated three times.
Steps to reproduce
1.Update craft to the latest versione 2.Update SEO to the latest version
Additional info
- Craft version:4.8.0
- SEO version:4.2.2
- PHP version:8.1
@giampo1991 Thanks for sharing—we'll take a look.
following, same problem here, on a multisite installation
- Craft CMS 4.8.3
- SEO version:4.2.2
- PHP_VERSION | 8.1.27
Same here 👋
Craft version: 4.8.1 SEO version: 4.2.2 PHP version: 8.2.0
Same issue here.
Craft version: 4.8.11
SEO version: 4.2.2
PHP version: 8.3.6
Issue seems to come from the fix related to the pagination in the canonical link. The getFullPath function returns the language path included in the path and the UrlHelper::siteUrl already has the language path in it. So it gets a double language path on the return.
Rolled back to version 4.2.1 to fix it. Don't have enough knowledge of craft and the pagination fix (what it fixes) to come up with a solution for this. Hope someone does!
Is there a solution to this problem? I have the same problem with my site.
I think that this broke the canonical. "use pagination information on canonical (via @therealpecus)"
Hi all, sorry for this nasty bug I introduced while fixing the canonical in paginated pages.
I'll take a look and revise the code so that it keeps pagination info but avoids repeating the language prefix. In the meanwhile you can downgrade to 4.2.1 as suggested (edit your composer.json and specify the dependency as
"ether/seo": "4.2.1",
without the caret in front, then run composer update
This is a serious issue. All our SEO traction we built until now has been on a slow decline for the past 2 months since the introduction to this issue.
to everyone coming across this issue:
- there is a PR ready since mid-May (#480 for v4, #481 for those still on craft 2.x) that fixes the regression while keeping pagination info on canonical
- @Tam needs to approve and merge in the main code branch and make a release to npm so that updating your plugin in Craft fixes the issue
This is a free plugin, and we can't expect the maintainer to be always available. I am providing a couple of workarounds to allow everyone to adopt a fix in the meanwhile. Use either one depending on your familiarity with the process.
workarounds
- downgrade to 4.2.1: run
composer require ether/seo:4.2.1(if you use version 3.x of the plugin, usecomposer require ether/seo:3.7.6) - alternatively, manually patch the plugin code adopting the changes in the PR: remove the red lines in
SeoData.phpand add the green lines from https://github.com/ethercreative/seo/pull/480/files . The file will be in yourvendor\ether\seo\src\models\datafolder. restart Craft to ensure changes are applied.
If you downgrade via composer, the plugin version will be pinned in your composer.json and composer will not try to update it. When an update is release, use composer require ether/seo to unpin the plugin version, or update via Craft UI.
Hi I use the latest version of craft cms 5 so i cannot downgrade to 4.2.1
Is there a workaround for that?
@therealpecus Hi I use the latest version of craft cms 5 so i cannot downgrade to 4.2.1
Is there a workaround for that?
@Baertie use the manual method per the post above:
manually patch the plugin code adopting the changes in the PR: remove the red lines in
SeoData.phpand add the green lines from https://github.com/ethercreative/seo/pull/480/files . The file will be in yourvendor\ether\seo\src\models\datafolder. restart Craft to ensure changes are applied.
for v5 the getCanonical function starts at line :378