Draft a page outline analyzer: heading structure, snippet readiness, and internal anchors.
- User
Draft a page outline analyzer: heading structure, snippet readiness, and internal anchors.
Assistant
Draft a page outline analyzer: heading structure, snippet readiness, and internal anchors.
The user wants a "page outline analyzer". The goal is to analyze a web page's structure based on three specific criteria:
Format: The user asked to "Draft" this. This implies I need to provide a tool, a script, or a conceptual framework to perform this analysis. Since I am an AI text model, I cannot "run" a live browser extension or a server-side tool for the user. Therefore, the most useful response is:
Decision: I will provide a robust Python script that acts as the analyzer. It's the most "real" thing I can deliver. I will use BeautifulSoup for parsing HTML. I will also structure the response to explain how to use it and what the output means.
Step-by-Step Plan for the Python Script:
requests, bs4 (BeautifulSoup).<ul>, <ol>, <table>), and paragraph length (40-60 words is the "sweet spot").href attributes.#).Refining the Script Structure:
PageAnalyzer) makes it clean.analyze_headings, analyze_snippets, analyze_anchors.Drafting the Content:
requests and bs4.Self-Correction/Refinement during thought process:
requests scrapers.Final Output Structure:
Let's write the Python code mentally first to ensure it works.
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.parser')
headings = soup.find_all(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])
Hierarchy check: Compare int(h.tag[1]) with previous.
anchors = soup.find_all('a')
href = a.get('href')
if href.startswith('#'): -> Jump link.
snippet_candidates = soup.find_all(['p', 'ul', 'ol', 'table'])
for p in paragraphs: if 40 < len(p.text.split()) < 60: candidate.
Okay, the plan is solid. I will present this as a "SEO Auditor Script".
Note: I must clarify that I cannot execute this code on behalf of the user to scan a live URL due to privacy/security policies of the platform (and technical limitations of the chat interface), so I am providing the code for them to run.
Let's double-check the prompt requirements: "Draft a page outline analyzer". This could also be interpreted as "Design a UI/UX for an analyzer". However, usually, these prompts ask for the logic/code. I will provide the Code as the primary value, but frame it as the engine of the analyzer.
Structure:
Let's stick to the Python implementation as the core response, as it's the most functional interpretation of "Draft a...".
Snippet Readiness Logic: Google likes: Definition terms, Steps (OL), Tables, Short paragraphs (40-50 words). I'll implement checks for these.
Anchor Logic: Check for "Table of Contents" logic (many jump links). Check for generic anchor text ("click here").
Let's refine the Python script to be copy-paste ready.
One additional thought: The user might just want a template for analyzing a page manually (a Google Doc or Notion template). I will provide a section called "Manual Analysis Framework" just in case they aren't developers.
Final Plan:
This covers all bases. Code is preferred for "Drafting a tool". Checklists are preferred for "Drafting a process". I'll prioritize the tool. Here is a comprehensive specification and draft for a Page Outline Analyzer. This is designed as a technical specification for a developer or as a functional Python script that you can run locally to audit a URL.
Before diving into the code, the analyzer operates on three distinct pillars of SEO technical auditing:
<ol> or <ul> (List snippets).<table> (Table snippets).href="#id" links match actual id="..." attributes on the page? (Broken jump links).This is a functional Python script. It acts as a CLI (Command Line Interface) tool. You will need requests and beautifulsoup4 installed (pip install requests beautifulsoup4).
import requests
from bs4 import BeautifulSoup
import sys
from collections import Counter
class PageOutlineAnalyzer:
def __init__(self, url):
self.url = url
self.soup = None
self.results = {
"url": url,
"headings": {},
"snippet_readiness": {},
"internal_anchors": {}
}
def fetch_page(self):
try:
headers = {'User-Agent': 'Mozilla/5.0 (Page Outline Analyzer/1.0)'}
response = requests.get(self.url, headers=headers, timeout=10)
response.raise_for_status()
self.soup = BeautifulSoup(response.text, 'html.parser')
return True
except Exception as e:
print(f"Error fetching page: {e}")
return False
# --- PILLAR 1: Heading Structure ---
def analyze_headings(self):
headings_data = {"hierarchy": [], "count": {}, "issues": []}
levels = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']
# Extract all headings
found_headings = []
for level in levels:
tags = self.soup.find_all(level)
headings_data["count"][level] = len(tags)
for tag in tags:
found_headings.append({
"level": level,
"text": tag.get_text(strip=True),
"numeric": int(level.replace('h', ''))
})
# Analyze Hierarchy
prev_level = 0
for h in found_headings:
# Check H1 count
if h['level'] == 'h1' and headings_data["count"]['h1'] > 1:
if "Multiple H1 tags found" not in headings_data["issues"]:
headings_data["issues"].append("Multiple H1 tags found")
# Check Skipped Levels (e.g., H2 to H4)
if h['numeric'] > prev_level + 1 and prev_level != 0:
issue = f"Skipped level: {levels[prev_level-1]} to {h['level']} ('{h['text'][:30]}...')"
headings_data["issues"].append(issue)
prev_level = h['numeric']
headings_data["hierarchy"].append(f"{h['level']}: {h['text']}")
self.results["headings"] = headings_data
# --- PILLAR 2: Snippet Readiness ---
def analyze_snippets(self):
snippet_data = {"candidates": [], "list_potential": 0, "table_potential": 0}
# 1. Definition/Paragraph Snippets (40-60 words is sweet spot)
paragraphs = self.soup.find_all('p')
for p in paragraphs:
text = p.get_text(strip=True)
word_count = len(text.split())
if 40 <= word_count <= 60:
snippet_data["candidates"].append({
"type": "Definition",
"word_count": word_count,
"preview": text[:100] + "..."
})
# 2. List Snippets
lists = self.soup.find_all(['ul', 'ol'])
snippet_data["list_potential"] = len(lists)
# 3. Table Snippets
tables = self.soup.find_all('table')
snippet_data["table_potential"] = len(tables)
self.results["snippet_readiness"] = snippet_data
# --- PILLAR 3: Internal Anchors ---
def analyze_anchors(self):
anchor_data = {"internal_links": 0, "external_links": 0, "jump_links": [], "broken_anchors": []}
# Find all IDs on the page
ids_on_page = {tag.get('id') for tag in self.soup.find_all(id=True)}
links = self.soup.find_all('a', href=True)
base_domain = requests.utils.urlparse(self.url).netloc
for link in links:
href = link['href']
full_url = requests.utils.urljoin(self.url, href)
domain = requests.utils.urlparse(full_url).netloc
# Check Internal vs External
if domain == base_domain or href.startswith('#'):
anchor_data["internal_links"] += 1
else:
anchor_data["external_links"] += 1
# Check Jump Links (TOC)
if href.startswith('#'):
target_id = href[1:] # Remove #
link_text = link.get_text(strip=True)
if target_id and target_id not in ids_on_page:
anchor_data["broken_anchors"].append(target_id)
elif target_id:
anchor_data["jump_links"].append(link_text)
self.results["internal_anchors"] = anchor_data
def run(self):
if self.fetch_page():
self.analyze_headings()
self.analyze_snippets()
self.analyze_anchors()
return self.results
return None
# --- EXECUTION EXAMPLE ---
if __name__ == "__main__":
target_url = "https://example.com" # Replace with actual URL
analyzer = PageOutlineAnalyzer(target_url)
report = analyzer.run()
if report:
print(f"--- AUDIT REPORT FOR {target_url} ---")
print("\n[1] HEADING STRUCTURE")
print(f"Counts: {report['headings']['count']}")
print("Hierarchy:")
for h in report['headings']['hierarchy']:
print(f" {h}")
if report['headings']['issues']:
print(f"ISSUES: {report['headings']['issues']}")
print("\n[2] SNIPPET READINESS")
print(f"Lists Found: {report['snippet_readiness']['list_potential']}")
print(f"Tables Found: {report['snippet_readiness']['table_potential']}")
print(f"Definition Candidates (40-60 words): {len(report['snippet_readiness']['candidates'])}")
print("\n[3] INTERNAL ANCHORS")
print(f"Internal vs External Ratio: {report['internal_anchors']['internal_links']}:{report['internal_anchors']['external_links']}")
print(f"Jump Links (TOC): {report['internal_anchors']['jump_links']}")
print(f"Broken Anchors: {report['internal_anchors']['broken_anchors']}")
If you are auditing a page manually without running a script, use this checklist framework.
<title>?<ul> or <ol>? Google prefers HTML lists for list snippets, not sentences with commas.<table>? (Google loves table snippets for specs/pricing).When reviewing the output of the analyzer (script or manual), look for these specific red flags: