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

Canoncial URL should use Url::current() instead of Url::full() #180

Closed
chescos opened this issue Sep 2, 2019 · 4 comments
Closed

Canoncial URL should use Url::current() instead of Url::full() #180

chescos opened this issue Sep 2, 2019 · 4 comments

Comments

@chescos
Copy link
Contributor

chescos commented Sep 2, 2019

When setting the config option meta.defaults.canonical to null, the canonical URL will be set from the value of Url::full() instead of Url::current(). Url::full() includes query parameters and the canonical URL is usually used to strip away query parameters like UTM tags, search parameters, and so on.

I mean, what's even the point of specifying a canonical URL from the full URL? That's exactly the same result as not setting a canonical URL at all.

@robinparisi
Copy link

robinparisi commented Apr 24, 2020

Indeed, the current use of Url::full() bring no benefit for SEO since it will just use the full URL and generate a lot of duplicate content.

Expected behaviour (current page => canonical URL):

https://example.com?utm_source=email => https://example.com
https://example.com/products?filter=asc => https://example.com/products
https://example.com/page?I_will_harm_your_SEO => https://example.com/page

This is the best default behavior because all important parameters for SEO should preferably use URL rewriting (so compatible with Url::current())

@J-Brk
Copy link
Collaborator

J-Brk commented Apr 27, 2021

XSS #247

@Barcelonczyk
Copy link

I totally agree that using Url::full() has no benefit for SEO.

It's worth mentioning that the config file is inconsistent in the current situation:

'canonical' => false, // Set null for using Url::current(), set false to total remove

'url' => false, // Set null for using Url::current(), set false to total remove

Based on the config file both opengraph url and canonical should use Url::current() but in fact, only opengraph url does it.

So using the same config for opengraph url and canonical we will receive e.g.

@vinicius73
Copy link
Member

vinicius73 commented Sep 29, 2021

Fixed on #255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants