SEO Issue - Docusaurus Canonical Redirect
I recently had some free time and decided to check the SEO status of all my sites. I noticed that there’s a recurring issue with sites built using Docusaurus. I’ve tried fixing a few errors, but the same one keeps popping up.
So, I checked the list of links and guess what? They all work perfectly without any redirects. That’s a bit puzzling, right? Later on, I tried using another service like https://ahrefs.com, and guess what? It gave me the same errors. What could be the cause of this issue?
So, I think the problem is that Docusaurus generates URLs without a trailing slash (/) and sometimes it does (like the canonical URL on the page). To fix this, we’ll need to add this configuration to the docusaurus.config.js file.
trailingSlash:true
As mentioned in https://docusaurus.io/docs/api/docusaurus-config#trailingSlash, this setting will force all URLs to have a slash. I’m keeping my fingers crossed that this issue goes away soon! Here’s some more info. It might not just be a Docusaurus issue, but also partly because of how the hosting provider handles the URL. We’re currently using Cloudflare Pages, and it seems to be treating https://server/page differently from https://server/page/. Let’s keep an eye on things for a few weeks and see if the change resolves the issue.