-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
feat(v2): add canonical URL to <head> #2694
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 2c63e05 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jcomack hmm, I wonder what the canonical URL should be if some hosting providers automatically (like Netlify) add trailing slashes by default?
For example, https://deploy-preview-2694--docusaurus-2.netlify.app/docs/introduction -> https://deploy-preview-2694--docusaurus-2.netlify.app/docs/introduction/ but canonical URL without trailing slash, it is OK?
<link data-react-helmet="true" rel="canonical" href="https://v2.docusaurus.io/docs/introduction">
Yes, that'll cause problems. Some nuance here, as:
|
So let's add trailing slash to permalink. |
That'd be great, if we could! :) |
Just curious about the status regarding this situation. Any updates? :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit. Should we add to the blog too?
We still needed to add trailing slash to permalink, didn't we? |
Yep! :) |
They have the same contents, why do we need the trailing slash? Google indexes both version of webpages similarly. The important thing here is to have the canonical tag, rather than not.
|
There are inconsistencies between the canonical URL value, the |
Hmm ok let's add the trailing slash then. |
Motivation
Currently Docusaurus does not support canonical URLs. From a search engine standpoint, a canonical URL is an important piece of information and can help direct them to the correct content.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
<link rel="canonical" href="<URL of the page you're currently viewing>" />
Related PRs
This PR is a good first step to further implement #2603, as it introduces a good default value.