Back to lessons

Hosting Operations

Find Duplicate Page Titles

You need to find repeated HTML title text across a built static site.

Command

grep -Rho --include='*.html' '[^<]*' public | sed 's###;s###' | sort | uniq -c | sort -nr

What changed

Nothing changes. The command reads HTML files, extracts title text, and counts repeats.

Danger

safe

When to use it

Use before publishing a static site or after template changes that may duplicate page titles.

When not to use it

Do not treat it as a complete SEO audit; it only checks the visible title element.

Undo or recovery

No undo needed because this command is read-only.

Expected output

A count-sorted list of title strings, with duplicates showing counts greater than one.

demo script

Disposable terminal steps

  1. find public -name '*.html' -maxdepth 3 -print
  2. grep -Rho --include='*.html' '[^<]*' public | sed 's###;s###' | sort | uniq -c | sort -nr

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ find public -name '*.html' -maxdepth 3 -print
public/about.html
public/draft.html
public/blog/post.html
public/index.html
::exit-code::0
$ grep -Rho --include='*.html' '[^<]*' public | sed 's###;s###' | sort | uniq -c | sort -nr
      2 Demo Site
      1 Post One
      1 Draft Page
::exit-code::0

YouTube Short

Find duplicate page titles.

When every page inherits the same title, search snippets get muddy. Count titles from the built HTML before shipping.

LinkedIn hook

Duplicate titles make a static site harder to scan in search results and browser tabs.

Question: Do you catch duplicate titles from templates before deploy?

experiments

A/B tests to run

Metric: save_rate

A: Find duplicate titles.

B: Your template copied one title everywhere.