# Canonical Tags — SEO for Developers

Source: https://www.geekswithgeeks.com/en/seo-developers/seo-canonical-tags

> Prevent duplicate content issues with canonical URL declarations.

## Duplicate content problem

The same content can live at multiple URLs: `example.com/page`, `www.example.com/page`, `example.com/page?utm=tracking`, etc. Search engines see these as separate pages, splitting ranking power. **Canonical tags** tell Google which is the preferred version.

## Canonical tag example

Place the canonical tag in the `<head>` of every duplicate. Point all variants to the primary URL.

```html
<!-- On page: example.com/article?id=123&utm_source=newsletter -->
<head>
  <link rel="canonical" href="https://example.com/article/123">
</head>

<!-- On page: www.example.com/article/123 -->
<head>
  <link rel="canonical" href="https://example.com/article/123">
</head>

<!-- All URLs point to the same canonical -->
<!-- Ranking power consolidates on example.com/article/123 -->
```

## Self-referential canonicals

Every page can have a canonical tag pointing to itself. This is optional but clarifies which version is the primary. Helpful for large sites.
