Add canonical links for SEO

Search engines want a single canonical URL per page. @nera-static/plugin-canonical-links emits the right <link rel="canonical"> tag on every page โ€” and alternate-language tags if you run a multilingual site.

1. Install and publish the template

npm install @nera-static/plugin-canonical-links
npx nera-canonical-links

2. Configure your origin

config/canonical-links.yaml:

app_origin: https://your-domain.com
page_identifier: slug
available_languages:
    - en

app_origin is the only value you must set โ€” it's the absolute origin canonical URLs are built from. Set it to your real domain before you launch.

3. Give pages a slug

With page_identifier: slug, each page contributes its slug frontmatter to the canonical URL:

---
title: Getting started
slug: getting-started
---

4. Emit the tags

The plugin sets meta.canonicalLink. Include the published partial in your layout's <head>:

head
  include ../vendor/plugin-canonical-links/index

Render and check the source of any page โ€” you'll see:

<link href="https://your-domain.com/docs/getting-started.html" rel="canonical" />

Every page on this site carries one, built exactly this way.