-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
docs: add canonical url in head #15984
Conversation
Run & review this pull request in StackBlitz Codeflow. |
One question before merging, is it ok that the canonical url is |
I thought so at first, but apparently |
Thanks for fixing this! 💜 |
Thanks!
|
@sapphi-red Does that mean changing |
Maybe we could detect if it is an Another inconsistency is that when you click on the sidebar, you get to @brc-dd maybe we are holding the hammer wrong here? Is there a way to only have the pages without the |
PS: The regex for canonical should be this though - PPS: You don't need canonical for algolia to dedupe. Just enable cleanUrls and it should work. We are using that on VitePress docs. |
Thanks @brc-dd! @GrygrFlzr let us know if you'd like to follow up with another PR. Just in case, I haven't yet deployed the docs, so there is no rush here. |
I can take a look in an hour. Is there a way to check on netlify if Algolia has properly deduplicated the index via canonization, at least? |
I don't think we can check that until we deploy 🤔 |
I think building the site and verifying that it matches the pattern Sapphi described should be good enough.
That way we can avoid an additional redirect from Netlify. I think overall it's not urgent though. |
Description
Fixes #15342 by adding canonical URL to the
<head>
of all pages.To check:
Additional context
transformHead
instead?transformHead
was a cleaner solution, but it only adds the canonical tag to the.html
variants of URLs, not the main pages. Canonical URLs are meant to be added to all variants of a page including the canonical page itself.ogUrl
as the base?.replace
calls instead of.replace(/(?:\/index)?\.md$/, '/')
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).Ideally, include relevant tests that fail without this PR but pass with it.