Sub topic 12
Auditing and revising existing pages
This chapter assumes you know basic HTML structure, what a search results page looks like, and what a target keyword is. It also assumes you have read the earlier chapters on writing titles, the h1 and heading hierarchy. Here you will put those pieces together. You will check a page, find the faults, and rewrite it.
What an audit looks for
An audit is a short, repeatable check of one page against a fixed list of questions. Running the same list each time makes pages comparable and keeps you from fixing things by feel.
| Check | Question to ask | Common fault |
|---|---|---|
| Title present | Does the page have one `<title>`? | Missing or empty title |
| Title unique | Does any other page share this title? | Duplicate titles across a site |
| Title length | Does it fit in search results? | Truncated with "..." |
| Keyword in title | Is the target keyword near the start? | Keyword absent or buried |
| h1 | Is there exactly one, and does it state the topic? | None, several, or a vague one |
| Hierarchy | Do levels go h1, h2, h3 without skipping? | An h4 straight after an h1 |
| Headings | Does each one describe its section? | "More", "Info", "Other" |
| Stuffing | Is the keyword repeated unnaturally? | Same phrase in every heading |
Audit a weak page
Here is the starting point from the plan. The target keyword is "repot a snake plant".
<!-- Weak: repeated keyword, skipped level, vague headings -->
<title>Snake plant | snake plant repotting | repot snake plant | best snake plant</title>
<h1>Snake Plant</h1>
<h4>Snake plant repotting tips snake plant</h4>
<h2>More</h2>Going through the checklist gives these findings:
- The title repeats "snake plant" four times. It is stuffed, and its length will likely be cut off in results.
- The exact target phrase appears only in the third segment, not at the start.
- The h1 names the plant but not the task. It does not match the search intent, which is to learn how to repot.
- The page jumps from h1 to h4, so the hierarchy skips levels.
- The h4 repeats the keyword awkwardly, and "More" tells a reader nothing.
Revise the title and outline
Fix the title first. Put the keyword near the start, state the page type, and keep it short.
<head>
<title>How to Repot a Snake Plant: Step-by-Step Guide</title>
<meta name="description" content="Learn when and how to repot a snake plant, which pot and soil to use, and how to avoid root damage.">
</head>Then rebuild the headings with one h1 and sections that follow the reader's questions.
<body>
<h1>How to Repot a Snake Plant</h1>
<h2>When to repot</h2>
<h2>What you need</h2>
<h3>Choosing a pot</h3>
<h3>Choosing soil</h3>
<h2>Step-by-step repotting</h2>
<h2>Aftercare</h2>
</body>Compare the two versions. The keyword now appears in the title and h1 once each. The h2 headings use related wording such as "pot" and "soil" instead of repeating the phrase. No level is skipped, so a screen reader user who lists headings gets a clear outline.
Audit many pages with a script
For a whole site, a script finds the mechanical faults quickly. This Python example reads local HTML files and reports missing or duplicate titles, h1 counts, and skipped levels. It uses only the standard library.
import re
import sys
from collections import defaultdict
from html.parser import HTMLParser
class PageParser(HTMLParser):
def __init__(self):
super().__init__()
self.title = ""
self.in_title = False
self.levels = []
def handle_starttag(self, tag, attrs):
if tag == "title":
self.in_title = True
elif re.fullmatch(r"h[1-6]", tag):
self.levels.append(int(tag[1]))
def handle_endtag(self, tag):
if tag == "title":
self.in_title = False
def handle_data(self, data):
if self.in_title:
self.title += data
def audit(paths):
seen = defaultdict(list)
for path in paths:
with open(path, encoding="utf-8") as f:
parser = PageParser()
parser.feed(f.read())
title = parser.title.strip()
problems = []
if not title:
problems.append("missing title")
else:
seen[title].append(path)
if len(title) > 60:
problems.append(f"title is {len(title)} characters")
h1_count = parser.levels.count(1)
if h1_count != 1:
problems.append(f"{h1_count} h1 elements")
for prev, cur in zip(parser.levels, parser.levels[1:]):
if cur > prev + 1:
problems.append(f"skips from h{prev} to h{cur}")
print(path, "->", problems or "ok")
for title, files in seen.items():
if len(files) > 1:
print("duplicate title:", title, files)
if __name__ == "__main__":
audit(sys.argv[1:])Run it with python audit.py page1.html page2.html. The 60-character limit is a rough guide, because display width depends on the letters used and on the device.
Revise and check the result
Search engines sometimes rewrite a title they judge to be a poor fit, so a title you changed may not display exactly as written. Treat the rewrite as feedback. If it keeps happening, your title probably does not match the page's h1 or content.
After publishing, wait for search engines to recrawl the page. Then compare how it appears in results and how it performs against your notes. Change one thing at a time where you can, so you know what caused any difference.
Exercise
A page has the title "Home", an h1 reading "Welcome", and an h3 directly after the h1. The target keyword is "indoor herb garden". Name three faults and one fix for each.
Show answer
First, the title "Home" is vague and lacks the keyword, so rewrite it as "How to Start an Indoor Herb Garden: Beginner Guide". Second, the h1 "Welcome" does not state the topic or match search intent, so change it to "How to Start an Indoor Herb Garden". Third, the jump from h1 to h3 skips a level, so change the h3 to an h2 (or add an h2 above it).
Exercise
Your audit script reports "duplicate title" for two pages about different plants. Why does that matter, and what should you do?
Show answer
Identical titles make the pages hard to tell apart in search results and give search engines less reason to treat each as a distinct answer. Give each page a unique title that starts with its own target keyword, for example "How to Repot a Snake Plant" and "How to Repot a Monstera".