SEO·Claude Code
SEOClaude Code

Fix the H1 tag — exactly one per pageClaude Code

Multiple H1s confuse crawlers about what a page is about. Zero H1s leaves Google guessing from weaker signals. Both hurt ranking, and both are common in AI-generated apps.

rocket_launch

Fixing this in Claude Code

Anthropic's official terminal coding agent

Claude Code can grep the whole codebase first, plan the change, then edit every affected file. Paste the prompt below into your Claude Code chat and the fix rolls out across the project in one pass.

Using a different tool? Pick your stack:

The prompt for Claude Code

Copy and paste this into your Claude Code chat exactly as-is.

Run Claude Code in the project root and make these exact changes, scanning the whole codebase first:

Fix the H1 tag

1. Make sure every page has exactly one <h1> tag.
2. Put the main keyword inside the H1.
3. Use <h2>/<h3> for subsections instead of multiple H1s.

Why this matters

The H1 is the structural title of the page as far as crawlers and screen readers are concerned. A clean heading hierarchy (one H1, nested H2s, H3s under those) is how Google understands what the page is about and how to match it to a query.

AI code generators frequently produce pages with a styled div that looks like a heading but is not, or a page with two H1s because both the hero and a section title were marked up the same way. Neither is a ranking disaster on its own, but they compound with other small issues to cap your ceiling.

Fixing the H1 is the single cheapest on-page SEO win. It takes under a minute per page and directly improves both ranking and accessibility.

How to use this prompt in Claude Code

  1. 1. Open your Claude Code project.
  2. 2. Copy the prompt above with the copy button.
  3. 3. Paste into the Claude Code chat and send.
  4. 4. Review the diff, accept the changes, redeploy.
  5. 5. Verify the fix using the checklist below.

Common mistakes to avoid

  • error_outlineHaving two H1s because the logo and the page title are both marked <h1>.
  • error_outlineUsing H1 for styling (large text) instead of structure, then having no real H1.
  • error_outlineLeaving the H1 generic like "Welcome" or "Home" instead of using a descriptive phrase.
  • error_outlineSkipping from H1 to H3 without any H2s in between.

How to verify the fix worked

  • check_circleRight-click → Inspect, run `document.querySelectorAll("h1").length` in the console — must be 1 on every page.
  • check_circleView source and confirm the H1 contains your primary keyword.
  • check_circleRun Lighthouse → Accessibility — "Heading order" should pass.
  • check_circleScreaming Frog crawl → H1 tab → no missing, no duplicates, no multiples.

Frequently asked questions

Can I have multiple H1s on a modern HTML5 page?expand_more
The HTML5 spec technically allows multiple H1s within sectioning elements, but Google, screen readers, and SEO tools still treat one-H1-per-page as the standard. Stick with one.
Should the H1 match the title tag?expand_more
They should be similar but not identical. The title is for the SERP, the H1 is for the on-page reader. Slight variation is natural.
Can the logo be the H1?expand_more
Only on the homepage, and only if the logo contains your brand as text. Even then, most SEOs prefer a descriptive H1 below the logo.

Want all 34 prompts tailored to your Claude Code site?

Pantra scans your site in 10 seconds, detects the stack, and generates the exact prompts that apply — only the ones you actually need.

Scan my site

Related Claude Code prompts