Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with canonical #469

Closed
giampo1991 opened this issue Mar 5, 2024 · 11 comments
Closed

Problem with canonical #469

giampo1991 opened this issue Mar 5, 2024 · 11 comments
Assignees

Comments

@giampo1991
Copy link

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
@alexjcollins
Copy link
Member

@giampo1991 Thanks for sharing—we'll take a look.

@cristiano-c1
Copy link

cristiano-c1 commented Mar 18, 2024

following, same problem here, on a multisite installation

  1. Craft CMS 4.8.3
  2. SEO version:4.2.2
  3. PHP_VERSION | 8.1.27

@fvwanja
Copy link

fvwanja commented Mar 19, 2024

Same here 👋

Craft version: 4.8.1
SEO version: 4.2.2
PHP version: 8.2.0

@HarroH
Copy link

HarroH commented Apr 30, 2024

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!

@mazaalai
Copy link

mazaalai commented May 21, 2024

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)"

image

@therealpecus
Copy link
Contributor

therealpecus commented May 21, 2024

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

@mateostabio
Copy link

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.

@therealpecus
Copy link
Contributor

to everyone coming across this 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, use composer require ether/seo:3.7.6)
  • alternatively, manually patch the plugin code adopting the changes in the PR: remove the red lines in SeoData.php and add the green lines from https://github.com/ethercreative/seo/pull/480/files . The file will be in your vendor\ether\seo\src\models\data folder. 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.

@Baertie
Copy link

Baertie commented Sep 16, 2024

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
Copy link

Baertie commented Oct 3, 2024

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

@therealpecus
Copy link
Contributor

@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.php and add the green lines from https://github.com/ethercreative/seo/pull/480/files . The file will be in your vendor\ether\seo\src\models\data folder. restart Craft to ensure changes are applied.

for v5 the getCanonical function starts at line :378

@Tam Tam closed this as completed Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants