All Docs
FeaturesCalmony Sanctions MonitorUpdated March 11, 2026

Canonical URLs & Duplicate Content Prevention

Canonical URLs & Duplicate Content Prevention

Introduced in v0.1.61 — SEO control SEO-05 (seo_meta_head)

What Are Canonical URLs?

A canonical URL is the single, authoritative address for a piece of content. When a page is reachable via multiple URLs — different domains, trailing-slash variants, query strings, or staging environments — the <link rel="canonical"> tag tells search engines which version to index and attribute ranking signals to.

Why This Matters

Without canonical links, Google may treat the following as separate pages with duplicate content:

  • https://calmony.com/ and https://calmony.com (trailing slash)
  • https://calmony.com and https://preview.calmony.com (staging domain)
  • https://www.calmony.com and https://calmony.com (www vs. apex)

Duplicate indexing dilutes ranking signals and can suppress organic visibility.

Implementation

Canonical URLs are set via Next.js metadata exports using the alternates.canonical field.

Root Layout (src/app/layout.tsx)

The root layout declares the site-wide canonical:

export const metadata: Metadata = {
  // ...other metadata
  alternates: {
    canonical: 'https://calmony.com',
  },
};

This renders as:

<link rel="canonical" href="https://calmony.com" />

Page-Specific Canonicals

Each marketing page exports its own canonical URL to override the root-level default:

// src/app/privacy/page.tsx
export const metadata: Metadata = {
  // ...other metadata
  alternates: {
    canonical: 'https://calmony.com/privacy',
  },
};

Guidelines for New Pages

When adding any new public-facing page:

  1. Export a metadata object from the page file.
  2. Always include alternates: { canonical: '<full absolute URL>' }.
  3. Use the production domain (https://calmony.com) — never a relative path or staging domain.
  4. For dynamic routes (e.g. /blog/[slug]), generate the canonical programmatically:
export async function generateMetadata({ params }: Props): Promise<Metadata> {
  return {
    alternates: {
      canonical: `https://calmony.com/blog/${params.slug}`,
    },
  };
}

Verification

After deployment, confirm canonical tags are rendered correctly by:

  1. Viewing page source and searching for rel="canonical".
  2. Using Google Search Console's URL Inspection tool.
  3. Running a crawl with a tool such as Screaming Frog or Ahrefs Site Audit.