Technical SEO

Duplicate title tags: find the template behind them and fix it once

Thousands of duplicate title tags usually have three or four causes: a layout default, a template missing one field, URL variants and pagination. How to tell them apart and fix each.

By SEOFix TeamPublished Updated
1,668 words · 8 min readMarkdown
Duplicate title tags: find the template behind them and fix it once

Duplicate title tags on a large site are almost never thousands of separate mistakes. They come from a handful of causes: a layout default that every page inherits, a template that leaves out the one field that tells pages apart, the same page reachable under several URLs, and pagination. Sort the duplicates by cause first, because each cause has a different fix, and one of them (pagination) often needs no fix at all.

What Google says about duplicate titles

Google's title link documentation asks for "distinct text that describes the content of the page in the <title> element for each page on your site" and says to "avoid repeated or boilerplate text." Its example: titling every page on a commerce site "Cheap products for sale" "makes it impossible for users to distinguish between two pages" (Google Search Central, title links).

Google also tells you what happens when titles repeat. In its list of common issues, "micro-boilerplate" is a set of pages that share one <title>, like a TV site where every season page is titled My so-called amazing TV show. Google says it "can detect the season number used in large, prominent title text and insert the season number in the title link." In other words, if your titles don't say what's different, Google may build its own title from your headings or other prominent text (title links). You lose control over the headline of your search result.

Two exceptions Google spells out:

  • Pagination. "Pages in a paginated sequence don't need to follow this recommendation. You can use the same titles and descriptions for all pages in the sequence. Google tries to recognize pages in a sequence and index them accordingly" (pagination guide).
  • Page numbers in titles. Asked whether to add the page number to category titles, Google's answer in the December 2022 SEO office hours was that it will likely "have little effect," and to add it if it helps users understand the page, not for ranking or indexing (office hours, December 2022).

Sort duplicate title tags by cause

Export every indexable 200 URL with its title, group by title, and look at what the URLs in each group have in common. Four patterns cover almost everything.

What the group looks likeCauseFix
Hundreds of different pages, title is the site name or a generic phraseA layout or app shell sets a default and the page never overrides itGive the route its own title
Pages of one type, e.g. /jobs/[slug], titles like "Accountant - Example Jobs"The template uses one field that isn't uniqueAdd the distinguishing field (company, city, size, date)
Same page under several URLs: ?sort=price, ?utm_source=, trailing slash, http://URL variantsCanonical, redirect or block crawling. Don't rewrite the titles
/blog?page=2, /blog?page=3...PaginationAllowed by Google. Optionally add the page number

A quick way to do the grouping from a crawl export (a CSV with url and title columns):

import csv, re
from collections import defaultdict

def template(path: str) -> str:
    parts = [p for p in path.split("?")[0].split("/") if p]
    if not parts:
        return "/"
    out = [parts[0]]
    for seg in parts[1:]:
        if seg.isdigit():
            out.append("[id]")
        elif "-" in seg or re.search(r"\d", seg) or len(seg) > 24:
            out.append("[slug]")
        else:
            out.append(seg)
    return "/" + "/".join(out)

groups = defaultdict(list)
with open("crawl.csv", newline="") as f:
    for row in csv.DictReader(f):
        path = re.sub(r"^https?://[^/]+", "", row["url"])
        groups[row["title"].strip()].append(path)

for title, paths in sorted(groups.items(), key=lambda kv: -len(kv[1])):
    if len(paths) < 2:
        continue
    templates = {template(p) for p in paths}
    has_query = sum("?" in p for p in paths)
    print(f"{len(paths):>6}  {title[:60]!r}  templates={sorted(templates)[:3]}  with_query={has_query}")

The template rule here is the one SEOFix uses to group URLs (Fixing by template): keep the first segment, turn all-digit segments into [id] and segments with a hyphen, a digit or more than 24 characters into [slug]. A big group spread across many templates is a layout default. A big group inside one template is a missing field. A group where most URLs have a query string is URL variants.

Cause 1: a layout default nobody overrides

This shows up as one title on hundreds of unrelated pages, often the brand name alone. It's common in single-page apps and in Next.js App Router projects.

In Next.js, a page that doesn't define title inherits it. title.default in a layout is "the default title for child segments (that do not define their own title)" (Next.js generateMetadata). So this root layout:

// app/layout.tsx
export const metadata = {
  title: { template: "%s | Example Jobs", default: "Example Jobs" },
};

gives every route without its own title the title "Example Jobs". The fix is per route, in the route's page.tsx or generateMetadata:

// app/companies/[slug]/page.tsx
import type { Metadata } from "next";
import { getCompany } from "@/lib/companies";

type Props = { params: Promise<{ slug: string }> };

export async function generateMetadata({ params }: Props): Promise<Metadata> {
  const { slug } = await params;
  const company = await getCompany(slug);
  // the layout template appends " | Example Jobs"
  return { title: `${company.name} jobs in ${company.city}` };
}

To find every route that still relies on the default, search the app/ directory for page.tsx files that export neither metadata nor generateMetadata:

for f in $(find app -name 'page.tsx'); do
  grep -qE 'export (const metadata|async function generateMetadata|function generateMetadata)' "$f" || echo "$f"
done

If the site renders titles client-side (React Helmet, document.title in an effect), the raw HTML may carry the shell's title on every route even when the browser shows the right one. Check with curl -s URL | grep -o '<title>[^<]*</title>' and see React SEO for single-page apps.

Cause 2: the template is missing the distinguishing field

On a job board, "Accountant - Example Jobs" is a fine title until there are 300 accountant jobs. On a store, "Linen Shirt" repeats across colours. The fix is to add the field that differs, in the order of what the searcher cares about:

Page typeUsually unique enough
Jobtitle + company + city
Product variant pagename + colour or size
Location pageservice + city (+ district)
Eventname + city + date
Person or company profilename + role or industry

If two items are genuinely identical (the same job posted twice), changing the title only hides the problem. Merge them or redirect one.

WordPress. Without an SEO plugin, change the title part through the document_title_parts filter, whose array holds title, page, tagline and site (WordPress developer reference):

add_filter( 'document_title_parts', function ( array $parts ): array {
    if ( is_singular( 'job_listing' ) ) {
        $id      = get_queried_object_id();
        $company = get_post_meta( $id, 'job_company', true );
        $city    = get_post_meta( $id, 'job_city', true );
        $parts['title'] = trim( get_the_title( $id )
            . ( $company ? " at $company" : '' )
            . ( $city ? " in $city" : '' ) );
    }
    return $parts;
} );

With Yoast, the same logic goes in the wpseo_title filter (Yoast metadata API), or into the post type's title template in Yoast's settings if the field is available there as a variable.

Shopify. The title comes from page_title in layout/theme.liquid. Shopify's documented pattern already handles two common duplicate sources: tag-filtered collections and pagination (Shopify, Add SEO metadata to your theme):

<title>
  {{ page_title -}}
  {%- if current_tags %} &ndash; tagged "{{ current_tags | join: ', ' }}"{% endif -%}
  {%- if current_page != 1 %} &ndash; Page {{ current_page }}{% endif -%}
  {%- unless page_title contains shop.name %} &ndash; {{ shop.name }}{% endunless -%}
</title>

If your theme prints only {{ page_title }}, every tag-filtered view of a collection gets the collection's title. Compare your theme.liquid with that block.

Cause 3: one page, many URLs

When the duplicate titles belong to /shoes, /shoes?sort=price, /shoes?utm_source=newsletter and /shoes/, the titles are right. The URLs are the problem. Giving each variant a different title would make it worse, because it tells Google these are different pages.

Fix the URLs instead:

  • Tracking and session parameters: a rel="canonical" to the clean URL. Google lists consolidating signals and choosing the URL shown in results as the reasons to set a canonical (consolidate duplicate URLs).
  • Host and slash variants (http, www, trailing slash): permanent redirects to one form.
  • Sort orders and filters you don't want indexed: Google's faceted navigation guide recommends preventing crawling of those URLs with robots.txt when you don't need them in Search, and notes that rel="canonical" to the unfiltered version "may, over time, decrease the crawl volume" but is "generally less effective in the long term" (faceted navigation).

Filters that you do want indexed (/shoes/red, /jobs/accountant/dubai) are real pages and need their own title built from the filter values.

For the Search Console side of URL variants, see Duplicate without user-selected canonical.

Cause 4: pagination

/blog, /blog?page=2 and /blog?page=3 sharing "Blog | Example" is allowed by Google, as quoted above. Add the page number if it helps users. It's cheap, it makes audit reports quieter, and a searcher who lands on page 4 knows where they are.

In Next.js, read the page number from searchParams (a promise in current versions, like params):

// app/blog/page.tsx
import type { Metadata } from "next";

type Props = { searchParams: Promise<{ page?: string }> };

export async function generateMetadata({ searchParams }: Props): Promise<Metadata> {
  const page = Number((await searchParams).page ?? "1");
  return { title: page > 1 ? `Blog, page ${page}` : "Blog" };
}

WordPress adds the page number for you through the page part of the document title on paginated archives (document_title_parts). Don't canonicalise page 2 to page 1 to silence the duplicates: Google's pagination guide says "Don't use the first page of a paginated sequence as the canonical page" (pagination).

Language versions with untranslated titles

A German page and its English twin that share an English title count as duplicates, and Google's title link docs say a title in a different writing system or language from the page may be replaced (title links). Translate the title along with the content. If the pages are linked with hreflang, check them too: hreflang errors.

Check the fix and keep it fixed

After deploying, fetch a sample from each group you fixed and confirm the titles now differ:

for u in /jobs/accountant-emaar-dubai /jobs/accountant-nakheel-dubai /jobs/accountant-adnoc-abu-dhabi; do
  curl -s "https://example.com$u" | grep -o '<title>[^<]*</title>'
done | sort | uniq -c

Every count should be 1. While you're there, grep -c '<title' on one page should print 1: a second <title> from a plugin or head manager is a separate bug.

SEOFix reports DUPLICATE_TITLE when two or more indexable 200 pages have exactly the same title. Noindex pages and pages canonicalised elsewhere are left out, because the site has already resolved those duplicates, and the issue lists up to 10 other URLs sharing the title plus the size of the group (Indexability checks). A title shared only with the page's own hreflang language versions is marked language_versions: true. Issues are grouped by template, so cause 1 and cause 2 show up as one task per template, and Verify fix rechecks the affected pages after you deploy.

FAQ

Do duplicate title tags cause a penalty? Google's documentation doesn't describe one. What it describes is the result: users can't tell the pages apart, and Google may write a different title link from the page's headings (title links).

Should paginated pages have unique titles? Google says they don't need to (pagination). Add "page N" if it helps users.

Should titles and H1s be different to avoid duplication? No. Asked whether title tags should match H1s, Google answered "just do whatever makes sense from a user's perspective" (office hours, June 2024). A title and H1 on the same page saying the same thing isn't duplication. Two pages with the same title is.

What about duplicate meta descriptions? Same causes, same templates. See meta description length, which covers generating descriptions by template.

SEOFix groups duplicate titles by the template that produces them, so a missing field on /jobs/[slug] is one task, not 3,000 rows. Your first audit is free, up to 500 pages.

ShareXLinkedIn