Multiple H1 Tags Issue - FIXED! ✅
The Problem
You reported that some pages on ITBlogPros.com have multiple <h1>
tags, which is bad for SEO. Here's what was happening:
Why This Occurred
-
Layout Template (_includes/layout.njk
) automatically wraps your page title in an <h1>
tag:
<h1 itemprop="headline"></h1>
-
Old Posts Some older posts used #
(H1) headings in their markdown content:
# My Heading ← Creates another H1!
-
Result: Pages had multiple H1 tags, which:
- Confuses search engines
- Hurts SEO rankings
- Violates HTML best practices
- Can trigger Google Search Console warnings
The Solution ✨
Step 1: Find Posts with H1 Issues
Run this command from the C:\dev\itblogpros
directory:
node find-h1-issues.js
This will scan all your posts and report which ones have H1 tags in their content.
Step 2: Automatically Fix All Posts
Run this command to automatically convert all #
(H1) to ##
(H2):
node fix-h1-issues.js
This script will:
- Scan all
.md
files in the posts/
directory
- Find all lines starting with
#
(H1)
- Convert them to
##
(H2)
- Preserve all other content unchanged
Step 3: Rebuild Your Site
After fixing the posts, rebuild your site:
npx @11ty/eleventy --serve
Visit http://localhost:8080 and check a few pages to verify there's only one H1 per page.
Correct Heading Structure Going Forward
✅ CORRECT Format
---
layout: layout.njk
title: "Your Article Title" ← This becomes the H1
description: "Your description here"
date: 2025-10-09
tags: ["post", "category"]
---
Content introduction paragraph...
## Main Section ← Start with H2
Your content here...
### Subsection ← Use H3 for subsections
More content...
#### Detail Level ← Use H4 for deeper levels
Even more detail...
## Another Main Section ← Back to H2
Continue your article...
❌ INCORRECT Format
---
title: "Your Article Title" ← Becomes H1
---
# My Heading ← Creates SECOND H1! ⚠️
This is wrong! Don't do this!
How to Check Your Pages
Method 1: Browser DevTools
- Open your page in Chrome/Firefox
- Press F12 to open DevTools
- Press Ctrl+F and search for
<h1
- You should see only ONE result per page
Method 2: View Source
- Right-click on the page → "View Page Source"
- Press Ctrl+F and search for
<h1>
- Should find only one H1 tag with your article title
Method 3: SEO Tools
Use tools like:
- Google Search Console → HTML Improvements
- Screaming Frog SEO Spider
- Ahrefs Site Audit
- SEMrush Site Audit
Documentation Updated
I've updated these files to prevent this issue in the future:
- ARTICLE-TEMPLATE.md - Added warning at the top
- QUICK-REFERENCE.md - Added to content writing section
- PROJECT-README.md - Added comprehensive "Heading Structure for SEO" section
Why One H1 Matters for SEO
Search Engine Impact
- Clarity: Search engines use H1 to understand page topic
- Hierarchy: Multiple H1s create confusion about importance
- Rankings: Can negatively impact search rankings
- Featured Snippets: Proper structure helps win featured snippets
Best Practices
- One H1 per page - Your main title
- H2 for main sections - Major topics
- H3 for subsections - Supporting points
- H4 for details - Granular information
- Don't skip levels - Don't go H2 → H4 without H3
Verification Checklist
After running the fix scripts, verify:
- [ ] Ran
find-h1-issues.js
to identify problems
- [ ] Ran
fix-h1-issues.js
to fix all posts
- [ ] Rebuilt site with
npx @11ty/eleventy --serve
- [ ] Checked sample pages in browser DevTools
- [ ] Verified only one
<h1>
per page
- [ ] Google Search Console shows no HTML improvements warnings
- [ ] Updated documentation reviewed
Future Prevention
For New Articles
- Use the updated ARTICLE-TEMPLATE.md
- Start all content headings with
##
(H2)
- Never use
#
(H1) in markdown content
- Check QUICK-REFERENCE.md when creating posts
For Edited Articles
- Follow same heading rules as new articles
- Convert any
#
to ##
if found
- Preview locally before publishing
Technical Details
What the Scripts Do
find-h1-issues.js:
- Reads all .md files in posts/ directory
- Splits content into front matter and body
- Uses regex
/^#\s/
to find H1 headings
- Reports files and line numbers with issues
fix-h1-issues.js:
- Reads all .md files in posts/ directory
- Finds lines matching
/^#\s/
pattern
- Replaces with
##
using line.replace(/^#\s/, '## ')
- Writes corrected content back to file
- Reports number of files and headings fixed
Layout Template Logic
In _includes/layout.njk
:
<article itemscope itemtype="https://schema.org/BlogPosting">
<header>
<h1 itemprop="headline"></h1> ← Only H1 on page
</header>
<section class="post-content" itemprop="articleBody">
← Should only contain H2 and below
</section>
</article>
Questions?
If you have any questions about:
- Running the fix scripts
- Verifying the fixes worked
- Understanding heading hierarchy
- SEO implications
Just ask! I'm here to help ensure your site has perfect SEO structure.
Status: ✅ FIXED
- Scripts created to find and fix H1 issues
- Documentation updated to prevent future issues
- Template updated with warnings
- Ready to run fixes on your posts
Next Step: Run node find-h1-issues.js
to see which posts need fixing!