Removing canonicalisation on a site with Gatsby and Netlify
The concept of "canonicalisation" or canonical URLs isn't something you can globally disable in Sanity itself—it's actually a frontend implementation concern, not a CMS feature.
Here's what you need to understand:
What Are Canonical URLs?
Canonical URLs are HTML <link> tags (typically <link rel="canonical" href="https://example.com/page">) that you add to your page's <head> section. They tell search engines which version of a page is the "preferred" one when you have duplicate or similar content at multiple URLs. According to Sanity's canonical URL glossary, they help prevent duplicate content issues and consolidate SEO signals.
How to "Remove" Canonicalisation
Since canonical tags are added in your frontend code (not in Sanity), here's how to remove them:
1. Check Your Frontend Templates
Look in your page templates where you render the <head> section. Common places include:
- Next.js:
pages/_document.js,app/layout.tsx, or individual page components - Gatsby:
gatsby-ssr.jsor page templates - Other frameworks: Your HTML template files
2. Remove the Canonical Tag Code
Find and remove code that looks like this:
// Example in Next.js
<Head>
<link rel="canonical" href={canonicalUrl} />
</Head>Or in your SEO component/plugin that might be generating these tags automatically.
3. Check SEO Plugins
If you're using an SEO plugin or package (like next-seo, react-helmet, or a Sanity SEO plugin), you may need to:
- Remove the canonical URL field from your Sanity schema
- Update your SEO component to not render canonical tags
- Check plugin configuration to disable canonical URL generation
Important Considerations
Before removing canonical tags, be aware that:
- They're generally considered an SEO best practice
- Removing them won't harm your site, but you'll lose the benefits of consolidating duplicate content signals
- If you have no duplicate content issues, canonical tags won't hurt anything (pages should self-reference their own canonical URL)
If You're Using Gatsby + Netlify
Since your search results mentioned "Gatsby and Netlify," check:
- Your Gatsby
gatsby-config.jsfor SEO plugins - Page templates in
src/templates/ - Any custom SEO components
- Your site's
<head>rendering logic
There is no global Sanity setting to disable canonicals—you control this entirely in your frontend code. If canonical tags are appearing on your site, they're being added by your frontend implementation, not by Sanity itself.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.