AdvancedLesson 30 of 3010 min read

Capstone: A Complete SEO Audit and Fix for a Small Business Site

Put the whole course together: crawl a test site, rank the problems, fix them in order, check again and write an honest report for the owner.

In this lesson you will

  • Run a full audit
  • Rank problems by impact
  • Fix in priority order
  • Write an honest report

About 24 minutes

Mina’s relaunch

Mina owns Harbour Bakery, a small shop with a ten-page website. She is about to relaunch it with new photos and a new menu, and she wants one thing before she does: ‘Can you check the whole site for problems, and fix what matters?’ This is your capstone. It brings together nearly everything in the course: crawling, status codes, redirects, canonical tags, noindex, structured data, images, sitemaps and prioritising. You will run a complete audit, rank the problems, fix them in order, check again and report. Everything about Harbour Bakery is made up.

The plan for the audit

  1. Agree the scope. Mina’s whole site, all ten pages. You will report problems and fix them on the test copy.
  2. Crawl. Start at the home page and follow links, recording each status, redirect, link and page element.
  3. Check. Run a fixed list of checks on what the crawl found.
  4. Rank. Label each problem High, Medium or Low, as explained below.
  5. Fix and re-check. Fix High problems first, then re-run the same audit.
  6. Report. Tell Mina what you found, what you changed and what is left.

How to rank problems

  • High: the problem stops search engines or visitors reaching a page, or sends them the wrong signal. Broken links, wrong canonical tags, noindex pages in the sitemap and temporary redirects on permanent moves.
  • Medium: the problem wastes effort or weakens a page, such as shared titles, invalid structured data, huge images and sitemap entries for missing pages.
  • Low: polish and completeness, such as missing alt text and pages absent from the sitemap.

A ranking like this is a judgement. Another consultant might move something up or down. What matters is that you can explain why, and that it follows impact on visitors and search engines.

Run the whole audit

The program below is the longest in the course, so do not try to read every line. Skim it from the top: a made-up website of ten pages is built with problems planted in it, a small web server shows it on your computer, and the audit function crawls and checks it. Then the report is printed, the fixes are applied, and the audit runs again. The output is real. We confirmed the findings a second way, with different tools: curl for the status codes and image size, and separate text searches for the page problems, both before and after the fixes.

import http.client, json, re, threading
from collections import Counter
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer

DESC = '<meta name="description" content="Fresh bread, cakes and coffee from Harbour Bakery in Leeds, baked every morning.">'
def page(title, h1, body="", head=""):
    return f"<html><head><title>{title}</title>{DESC}{head}</head><body><h1>{h1}</h1>{body}</body></html>"
NAV = " ".join(f'<a href="/{p}/">{p}</a>' for p in ["cakes", "menu", "about", "blog", "contact", "gallery"])
ld_ok = json.dumps({"@context": "https://schema.org", "@type": "Bakery", "name": "Harbour Bakery"})
site = {
 "/": (200, None, page("Harbour Bakery | Bread in Leeds", "Harbour Bakery", NAV)),
 "/cakes/": (200, None, page("Celebration Cakes | Harbour Bakery", "Cakes", '<a href="/cake-orders/">Order</a>')),
 "/cake-orders/": (302, "/orders/", ""),
 "/orders/": (200, None, page("Order a Cake | Harbour Bakery", "Order a cake")),
 "/menu/": (200, None, page("Menu | Harbour Bakery", "Menu", head='<meta name="robots" content="noindex">')),
 "/about/": (200, None, page("Harbour Bakery | Bread in Leeds", "About us", '<img src="/img/team.jpg"><a href="/jobs/">Jobs</a>')),
 "/blog/": (200, None, page("Baking Blog | Harbour Bakery", "Blog", '<a href="/blog/first-loaf/">First loaf</a>')),
 "/blog/first-loaf/": (200, None, page("Our First Loaf | Harbour Bakery", "First loaf", head='<link rel="canonical" href="/blog/first-loaf-old/">')),
 "/contact/": (200, None, page("Contact | Harbour Bakery", "Contact", head='<script type="application/ld+json">{"@type": "Bakery", "name": }</script>')),
 "/gallery/": (200, None, page("Gallery | Harbour Bakery", "Gallery", '<img src="/img/hero.jpg" alt="Loaves on a table">')),
 "/img/hero.jpg": (200, None, "x" * 1_800_000),
 "/img/team.jpg": (200, None, "x" * 40_000),
}
site["/sitemap.xml"] = (200, None, "".join(f"<loc>{u}</loc>" for u in
    ["/", "/cakes/", "/menu/", "/about/", "/blog/", "/contact/", "/gallery/", "/old/"]))

class Bakery(BaseHTTPRequestHandler):
    def do_GET(self): self.send(True)
    def do_HEAD(self): self.send(False)
    def send(self, body):
        code, to, text = site.get(self.path, (404, None, "Not found"))
        data = text.encode()
        self.send_response(code)
        if to: self.send_header("Location", to)
        self.send_header("Content-Length", str(len(data))); self.end_headers()
        if body: self.wfile.write(data)
    def log_message(self, *a): pass
server = ThreadingHTTPServer(("127.0.0.1", 0), Bakery)
port = server.server_address[1]
threading.Thread(target=server.serve_forever, daemon=True).start()

def ask(path, method="GET"):
    c = http.client.HTTPConnection("127.0.0.1", port); c.request(method, path)
    r = c.getresponse(); out = (r.status, r.getheader("Location"), r.read().decode(), int(r.getheader("Content-Length"))); c.close(); return out

def audit():
    problems, seen, queue, titles = [], set(), ["/"], {}
    pages = {}
    while queue:
        path = queue.pop(0)
        if path in seen: continue
        seen.add(path)
        status, to, body, size = ask(path)
        if status in (301, 302):
            queue.append(to); continue
        if status != 200 or not path.endswith("/") and path != "/": continue
        pages[path] = body
        for src in re.findall(r'<img src="([^"]+)"', body):
            if ask(src, "HEAD")[3] > 500_000: problems.append(("Medium", f"{src} is over 500 KB"))
        if re.search(r'<img(?![^>]*alt=)', body): problems.append(("Low", f"{path} image has no alt"))
        if 'content="noindex"' in body: pages[path] = "NOINDEX" + body
        t = re.search(r"<title>(.*?)</title>", body).group(1)
        titles.setdefault(t, []).append(path)
        m = re.search(r'rel="canonical" href="([^"]+)"', body)
        if m and ask(m.group(1))[0] != 200: problems.append(("High", f"{path} canonical goes to a 404"))
        j = re.search(r'ld\+json">(.*?)</script>', body)
        if j:
            try: json.loads(j.group(1))
            except ValueError: problems.append(("Medium", f"{path} has invalid JSON-LD"))
        for link in re.findall(r'<a href="([^"]+)"', body):
            code, to2, _, _ = ask(link)
            if code == 404: problems.append(("High", f"{path} links to missing {link}"))
            if code in (301, 302):
                problems.append(("High" if code == 302 else "Medium", f"{link} is a {code}, link to {to2}"))
            queue.append(link)
    for t, ps in titles.items():
        if len(ps) > 1: problems.append(("Medium", f"{len(ps)} pages share a title"))
    smap = re.findall(r"<loc>(.*?)</loc>", ask("/sitemap.xml")[2])
    for u in smap:
        if ask(u)[0] == 404: problems.append(("Medium", f"sitemap lists missing {u}"))
        if pages.get(u, "").startswith("NOINDEX"): problems.append(("High", f"sitemap lists noindex {u}"))
    for p in pages:
        if p not in smap and not pages[p].startswith("NOINDEX"): problems.append(("Low", f"{p} not in sitemap"))
    return problems

def report(label, problems):
    order = {"High": 0, "Medium": 1, "Low": 2}
    print(f"{label}: {len(problems)} problems", dict(Counter(s for s, _ in problems)))
    for sev, msg in sorted(problems, key=lambda p: order[p[0]]):
        print(f"  {sev}: {msg}")

before = audit()
report("BEFORE", before)

# the fixes, in priority order
site["/about/"] = (200, None, page("About Harbour Bakery", "About us", '<img src="/img/team.jpg" alt="The baking team">'))
site["/menu/"] = (200, None, page("Menu | Harbour Bakery", "Menu"))
site["/blog/first-loaf/"] = (200, None, page("Our First Loaf | Harbour Bakery", "First loaf"))
site["/cakes/"] = (200, None, page("Celebration Cakes | Harbour Bakery", "Cakes", '<a href="/orders/">Order</a>'))
site["/contact/"] = (200, None, page("Contact | Harbour Bakery", "Contact", head='<script type="application/ld+json">' + ld_ok + '</script>'))
site["/img/hero.jpg"] = (200, None, "x" * 180_000)
site["/orders/"] = (200, None, page("Order a Cake | Harbour Bakery", "Order a cake"))
site["/sitemap.xml"] = (200, None, "".join(f"<loc>{u}</loc>" for u in
    ["/", "/cakes/", "/menu/", "/about/", "/blog/", "/blog/first-loaf/", "/contact/", "/gallery/", "/orders/"]))
after = audit()
report("AFTER", after)
server.shutdown()
BEFORE: 11 problems {'High': 4, 'Low': 3, 'Medium': 4}
  High: /cake-orders/ is a 302, link to /orders/
  High: /about/ links to missing /jobs/
  High: /blog/first-loaf/ canonical goes to a 404
  High: sitemap lists noindex /menu/
  Medium: /contact/ has invalid JSON-LD
  Medium: /img/hero.jpg is over 500 KB
  Medium: 2 pages share a title
  Medium: sitemap lists missing /old/
  Low: /about/ image has no alt
  Low: /blog/first-loaf/ not in sitemap
  Low: /orders/ not in sitemap
AFTER: 0 problems {}

The first audit found 11 problems: 4 High, 4 Medium and 3 Low. The second found 0. Here is what each finding meant, in plain words, so you could explain it to Mina.

  • A 302 on a link. The cakes page links to a cake-orders address that sends visitors on to the real orders page with a temporary redirect. The fix: link straight to the final address.
  • A broken link. The about page links to a jobs page that does not exist. Fix the link or add the page.
  • A canonical tag pointing to a 404. The first-loaf blog post names a different address as its main version, and that address does not exist. This can confuse search engines about which page to index.
  • A noindex page in the sitemap. The menu page says ‘do not index me’ but the sitemap says ‘please index me’. The page should not send both signals.
  • Invalid structured data. The contact page has a broken block of JSON-LD with a missing value.
  • An image over 500 KB. The gallery picture weighs about 1.8 MB in this test, far too heavy for a phone (lesson 8).
  • Shared titles. The home page and the about page both have the same title, so the two pages look alike in search results.
  • The sitemap lists a missing page. The old address returns a 404.
  • Low priority: an image without alt text, and two live pages that the sitemap forgot.

The fixes in the program follow the priority order. The links, canonical tag and sitemap come first because they mislead engines. The structured data, image and titles come next. The alt text and sitemap gaps are last. After the fixes the audit reports no problems.

Zero is not perfect

The audit found nothing in its second run, but that does not mean the site is excellent. It checks only the things it was written to check. It does not judge whether Mina’s pages answer what customers search for (lessons 2, 3 and 5), whether the content is original and trustworthy (lesson 26), whether the local profile and listings match (lesson 16), how fast the pages feel on a real phone (lessons 8 and 19), or which keywords the pages should target (lesson 11). A clean automated audit is the floor. The ceiling is the quality of the pages and the business behind them.

The report for Mina

  1. Summary in plain words. ‘We found 11 problems. We fixed all 11 on the test copy. Here is what to publish.’
  2. Findings by priority, each with the page, the problem, why it matters and the fix.
  3. What we did not check, and our suggestions for the next three months, such as the keyword map, content plan and local setup.
  4. How we will measure. The Search Console numbers to watch, the dates, and an honest note that results take time and cannot be promised.

Where to go from here

You have now covered the whole path: how search works, how to plan and write for people, how to keep a site technically healthy, how to work with shops, languages and large sites, and how to run projects and talk about the work honestly. The best next step is practice. Audit your own site or a volunteer project. Build a portfolio from real before-and-after work. Keep reading the official documentation, because the details change every year. Be curious, test before you trust, and stay honest about what you know.

Fixing in the wrong order

Fixing everything the audit reports, in the order it prints it. Rank first. A project that spends a week on alt text while a canonical tag points at a missing page has its priorities upside down.

A test, not a real client

This site, the problems and the numbers are an invented test. A real audit has many more checks, much more data and many judgement calls, and it needs access, permission and a plan for undoing any change that goes wrong.

Do your own capstone. Choose a small real site you have permission to audit. Run a crawl or a manual check for the problems in this lesson, rank what you find, fix the top three on a test copy or via the owner, re-check, and write a one-page report. Keep it for your portfolio.

Your capstone

Check what you learned

Five quick questions. Pick an answer and you will see straight away whether it is right and why.

Why were the High problems fixed first?

  1. They mislead search engines or block visitors
  2. They are quickest to type
  3. They are cheapest
  4. They are alphabetical

Problems that stop pages being reached or send wrong signals do the most damage.

Which problem sent two signals at once?

  1. A missing alt
  2. A noindex page listed in the sitemap
  3. A large image
  4. A shared title

The page says do not index while the sitemap asks for indexing.

Why is a clean audit not proof of an excellent site?

  1. Audits are always wrong
  2. It deletes content
  3. It only checks colour
  4. It only checks what it was written to check

It cannot judge content quality, intent, trust, local signals or real speed.

What should a report to the owner include?

  1. A promise of rank one
  2. Findings, fixes, what was not checked, next steps
  3. Only a screenshot
  4. A secret list of tricks

A clear, honest report lists what was found and done, what is left, and how you will measure.

What is the best link for the cake orders page?

  1. A temporary redirect
  2. The home page
  3. A 404 page
  4. The final orders address

Linking straight to the final address avoids an extra hop and a temporary redirect.

Summary

  • A full audit crawls, checks, ranks, fixes, re-checks and reports.
  • Rank problems by effect on visitors and search engines before fixing.
  • A clean automated audit is a floor, not proof of quality.
  • Report findings, fixes, limits and next steps honestly.

Next lesson

You have finished the SEO course. Choose your next course from the Skills page.

Questions

Can I use this audit on a real site?

The ideas, yes. The program is a teaching model. Use real crawlers and Search Console for real sites, only with permission, and test changes on a copy first.

How long does an audit like this take?

A small site can take a few hours to crawl, check and write up. Large sites take much longer, and the fixing and testing usually take longer than the finding.

What should I do after the capstone?

Apply it to a real project, build your portfolio and keep reading Google Search Central. SEO changes, so regular practice and reading keep your skills current.

Progress is saved in this browser.