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

Test for rel=canonical the same as a redirect #643

Open
fulldecent opened this issue May 18, 2021 · 3 comments
Open

Test for rel=canonical the same as a redirect #643

fulldecent opened this issue May 18, 2021 · 3 comments

Comments

@fulldecent
Copy link
Collaborator

Currently we test for redirects. So we can mark as an error if you are linking to a page that has a redirect. That's good.

A redirect can be implemented by using HTTP or putting it in the HTML meta.

But I also consider a rel=canonical as a redirect if the page you are accessing is not the canonical URL. This is because GitHub Pages (and maybe some other static web hosts) don't let you set redirects and your page is accessible as extensionless (preferred) as well as .html. If the canonical one is extensionless and you are linking to .html that should be detectable as an error.

@gjtorikian
Copy link
Owner

Can you point me to a real-life website with rel="canonical" so that I can see the behavior of how a browser or curl handles these situations?

@fulldecent
Copy link
Collaborator Author

Browsers and cURL do not do anything special with this.

Basically only search engines will use this URL as a hint for giving other pages preference in listings.

Definition at https://html.spec.whatwg.org/#link-type-canonical

@gjtorikian
Copy link
Owner

Gotcha, thanks

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

3 participants
@gjtorikian @fulldecent and others