skills/seo/technical/canonical/SKILL.md
When the user wants to configure canonical URLs, fix duplicate content, or consolidate URL signals. Also use when the user mentions "canonical," "canonical URL," "duplicate content," "duplicate content fix," "preferred URL," or "URL consolidation." For GSC duplicates, use google-search-console.
npx skillsauth add kostja94/marketing-skills canonical-tagInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guides canonical tag configuration to consolidate duplicate content and declare preferred URLs.
When invoking: On first use, if helpful, open with 1–2 sentences on what this skill covers and why it matters, then provide the main output. On subsequent use or when the user asks to skip, go directly to the main output.
Check for project context first: If .claude/project-context.md or .cursor/project-context.md exists, read it for site URL and language structure.
Identify:
| Method | When | Strength | |--------|------|----------| | 301 redirect | Preferred; server can redirect | Strongest — permanent redirect | | Canonical tag | Cannot redirect (e.g. params, pagination) | Strong — HTML signal | | robots.txt | Block non-canonical paths | Weak — advisory only |
Use 301 for HTTP→HTTPS, www variants, trailing slash. Use canonical for params, pagination, UTM.
HTTPS is a ranking signal (Google, 2014). Users and crawlers should access only the HTTPS version.
| Requirement | Action |
|-------------|--------|
| SSL/TLS certificate | Install valid certificate; use Let's Encrypt for free |
| 301 redirect | HTTP → HTTPS; all HTTP requests redirect to HTTPS |
| Mixed content | No HTTP resources on HTTPS pages; fix mixed content warnings |
| HSTS | Optional; Strict-Transport-Security header for repeat visitors |
WWW vs non-WWW: Choose one preferred version; 301 redirect the other. See canonical rules above.
| Rule | Note |
|------|------|
| Absolute URL | Include https:// |
| Consistency | Must match current page URL or the chosen preferred version |
| No chains | A→B→C is invalid |
export const metadata = {
alternates: {
canonical: "https://example.com/page-slug",
languages: {
zh: "https://example.com/zh/page-slug",
en: "https://example.com/page-slug",
"x-default": "https://example.com/page-slug",
},
},
};
<link rel="canonical" href="https://example.com/page-slug" />
Apache (.htaccess):
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Nginx:
return 301 https://$host$request_uri;
testing
When the user wants to create, audit, or optimize sitemap.xml. Also use when the user mentions "sitemap," "sitemap.xml," "sitemap index," "lastmod," "changefreq," "priority," "URL discovery," "URL discovery for search engines," "single source of truth," "URL config," "unify sitemap IndexNow," or "reduce duplicate maintenance." For IndexNow, use indexnow.
development
When the user wants to configure, audit, or optimize robots.txt. Also use when the user mentions "robots.txt," "crawler rules," "block crawlers," "AI crawlers," "GPTBot," "allow/disallow," "disallow path," "crawl directives," "user-agent," "block Googlebot," "fix robots.txt," "robots.txt blocking," or "search engine crawling." For indexing, use indexing.
testing
When the user wants to create SEO pages at scale using templates and data—including AI-assisted, grounded copy for per-URL differentiation (vs rigid mail-merge templates). Also use when the user mentions "programmatic SEO," "programmatic SEO pages," "template pages," "scale content," "location pages," "city pages," "comparison pages at scale," "X vs Y pages," "integration pages," "pages from data," "automated landing pages," or "programmatic landing pages." Uses a playbook matrix aligned to skills under skills/pages. For user-facing template galleries or marketplaces (browse → use), use template-page-generator.
data-ai
When the user wants to add or optimize Twitter Card metadata for X (Twitter) link previews. Also use when the user mentions "Twitter Card," "twitter:card," "twitter:image," "twitter:title," "X preview," or "tweet preview." For Facebook/LinkedIn previews, use open-graph.