Sub topic 2
Build a content inventory
A content inventory is a single table that lists every indexable URL on your site next to the data you need to judge it. Every later decision in this tutorial depends on it: whether to refresh, merge, redirect or remove a page. This chapter shows how to build one from three sources and how to avoid the errors that make an inventory misleading.
This chapter assumes you can export reports from Google Search Console (Performance and Pages), read basic HTML and URLs, and edit pages in a CMS. It also assumes you know what Python's csv module does.
What the inventory is for
An inventory answers three questions for each URL:
- Does the page exist, and can search engines index it?
- Has it earned traffic, impressions and rankings, and is that trend rising or falling?
- Who owns it, when did it last change, and what is it about?
Without these facts you end up deciding page by page from memory. With them you can sort the whole site and see patterns, such as a cluster of old posts on one topic that all lost clicks in the same month.
Choose the sources
No single tool holds everything, so you join three sources on the URL.
| Source | What it gives you | Typical export |
|---|---|---|
| Crawl of your site | Status code, title, H1, word count, canonical URL, indexability, internal links in, last modified | Crawler CSV (Screaming Frog, Sitebulb or a custom script) |
| Search Console | Clicks, impressions, average position per page and per query | Performance report, Pages tab, plus a Query and Page export |
| Sitemap and CMS | The URLs you intend to be indexed, publish date, author, category | `sitemap.xml`, CMS export |
Add analytics sessions or conversions if you have them. Search Console shows search behavior only, and a page with few clicks may still drive sign-ups from other channels.
Why the crawl matters
Search Console only lists URLs that received impressions. A page with zero impressions will not appear in it at all, yet it is often the best candidate for removal. The crawl and the sitemap supply those pages. Start from the union of all three sources, not from Search Console alone.
Define the columns
Keep the first version small. These columns are enough to support the decision framework in a later chapter.
| Column | Source | Use |
|---|---|---|
| `url` | all | Join key |
| `status` | crawl | Flags 3xx, 4xx and 5xx URLs |
| `indexable` | crawl | `noindex` or a canonical pointing elsewhere |
| `title`, `h1` | crawl | Spot overlapping topics |
| `word_count` | crawl | Spot thin pages |
| `published`, `modified` | CMS | Age and last real update |
| `clicks_current`, `clicks_previous` | Search Console | Trend |
| `impressions_current` | Search Console | Demand and visibility |
| `avg_position` | Search Console | Distance from page one |
| `backlinks` | link tool | Link equity to protect |
| `action` | you | Keep, refresh, consolidate or remove (left blank for now) |
Leave action empty. Filling it in during the build biases you before the data is complete.
Pick comparable date ranges
Trend columns need two periods of equal length. A common choice is the last 3 months against the same 3 months a year earlier. The year-earlier comparison removes seasonality, such as a tax guide that always peaks in spring. If a page is under a year old, compare it with the previous 3 months instead and mark that in a note column.
Export at least 16 months of data if you can. Search Console keeps 16 months, so this is the maximum window, and you lose older data the longer you wait.
Normalize URLs before joining
The most common inventory error is a failed join. The same page can appear as:
https://example.com/guideandhttps://example.com/guide/http://andhttps://- With and without
www. - With tracking parameters such as
?utm_source=news - With a fragment such as
#section-2
If you join without normalizing, one page splits into several rows and its clicks look smaller than they are. Decide on the form your site uses as canonical and convert every source to it.
from urllib.parse import urlsplit, urlunsplit
def normalize(url: str) -> str:
parts = urlsplit(url.strip())
host = parts.netloc.lower().removeprefix("www.")
path = parts.path or "/"
if not path.endswith("/") and "." not in path.rsplit("/", 1)[-1]:
path += "/"
return urlunsplit(("https", host, path, "", ""))
print(normalize("http://www.Example.com/guide?utm_source=news#top"))This prints https://example.com/guide/. It drops the query string, so only use it if your site does not rely on parameters to show different content. If it does, keep those parameters and strip only tracking ones.
Build the table
The script below joins a crawl export and a Search Console pages export. It assumes two CSV files and the column names shown in the comments. Adjust the names to match your tools.
import csv
from urllib.parse import urlsplit, urlunsplit
def normalize(url: str) -> str:
parts = urlsplit(url.strip())
host = parts.netloc.lower().removeprefix("www.")
path = parts.path or "/"
if not path.endswith("/") and "." not in path.rsplit("/", 1)[-1]:
path += "/"
return urlunsplit(("https", host, path, "", ""))
inventory = {}
# crawl.csv columns: Address, Status Code, Indexability, Title 1, Word Count
with open("crawl.csv", newline="", encoding="utf-8") as f:
for row in csv.DictReader(f):
url = normalize(row["Address"])
inventory[url] = {
"url": url,
"status": row["Status Code"],
"indexable": row["Indexability"],
"title": row["Title 1"],
"word_count": row["Word Count"],
"clicks_current": 0,
"impressions_current": 0,
"in_search_console": "no",
}
# gsc_pages.csv columns: Page, Clicks, Impressions
with open("gsc_pages.csv", newline="", encoding="utf-8") as f:
for row in csv.DictReader(f):
url = normalize(row["Page"])
record = inventory.setdefault(url, {
"url": url, "status": "not crawled", "indexable": "",
"title": "", "word_count": "",
"clicks_current": 0, "impressions_current": 0,
"in_search_console": "no",
})
record["clicks_current"] += int(row["Clicks"])
record["impressions_current"] += int(row["Impressions"])
record["in_search_console"] = "yes"
fields = ["url", "status", "indexable", "title", "word_count",
"clicks_current", "impressions_current", "in_search_console", "action"]
with open("inventory.csv", "w", newline="", encoding="utf-8") as f:
writer = csv.DictWriter(f, fieldnames=fields, restval="")
writer.writeheader()
writer.writerows(inventory.values())Note the += on clicks. Because several raw URLs can normalize to one, you must add their numbers instead of overwriting them. The not crawled status marks URLs that earned impressions but your crawler never reached. Those are often orphaned pages with no internal links, or old URLs that now redirect, and both deserve a look.
The flow below shows how the sources combine.
Check the inventory before trusting it
Run these checks every time.
- Count the rows. Compare them with the number of URLs in your sitemap. A large gap means a source is missing.
- Look for duplicates after normalization. Sort by
urland scan. - Filter for
statusvalues other than 200. Redirecting and erroring URLs should not be treated as content pages. - Sum total clicks and compare with the Search Console total for the same period. Small differences are normal, because Search Console anonymizes some queries and caps exports at 1,000 rows in the interface. A large difference means your export was truncated.
- Spot-check five URLs by opening them.
Common errors
- Joining on page title. Titles repeat and change. Join on normalized URL only.
- Counting redirected URLs as pages. A 301 URL has no content of its own. Record its target instead.
- Ignoring non-indexable pages. A page with a
noindextag still appears in a crawl. Keep it in the table but mark it so you do not try to rank it. - Mixing date ranges. Comparing 3 months with 6 months makes every page look like it grew or shrank.
- Treating zero clicks as zero value. A page may support conversions, serve as a reference for customer support, or hold backlinks. Check
backlinksand analytics before marking it for removal.
What to do next
With the inventory built, you have the raw material for diagnosis. The next chapter sorts it by trend, so that you can tell whether a drop is concentrated in a few URLs, spread across a topic, or site-wide. Keep the CSV, because the later chapters add columns to it: query overlap, intent notes and the final decision.
Exercise
Your inventory shows a guide with 40 clicks, but Search Console's Pages report shows 90 clicks for the same guide. The inventory was built by joining on exact URL strings. What is the most likely cause, and how do you fix it?
Show answer
The guide is probably split across several URL variants, such as with and without a trailing slash, http against https, or a ?utm_ parameter, so only one variant matched the crawl row and the clicks of the others were lost or sit in separate rows. Normalize every URL (scheme, host, trailing slash, tracking parameters) in all sources before joining, and add click counts with += when several raw URLs map to one normalized URL.
Exercise
Why should you start the inventory from the crawl and sitemap rather than from the Search Console export alone?
Show answer
Search Console lists only URLs that received impressions in the chosen period. Pages with no impressions, which are strong candidates for refreshing, merging or removal, never appear in it. The crawl and sitemap supply the complete list of URLs so those pages show up with zero clicks.