Skip to content
Tutorials Center
My learning

Topics

Lesson 34 of 36 ยท Projects and Practice

Project: Build a Meta Tag Auditor

Build a small Python tool that audits titles, meta descriptions, headings, canonicals, images and structured data for a set of pages and prints a scored report.

In this project you will build a small auditor that reads the HTML of several pages and reports on-page SEO problems. It uses only Python's standard library, so it runs right here. You will reuse ideas from the whole course: titles and descriptions, headings, canonicals and robots directives, image alt text, structured data and the checks from SEO Audits and Tools.

The plan

The tool has three parts:

  1. Parse: an HTMLParser collects the SEO-relevant parts of each page.
  2. Check: a list of rules turns those facts into problems with a severity.
  3. Report: a short summary and a score per page, worst first.

Nothing is fetched from the network. The pages are strings, which keeps the project deterministic and easy to test; to audit real pages you would download HTML with a crawler or urllib and feed it in.

Step 1: the parser

Python Step 1: collect the facts

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Step 2: the rules

Each rule looks at the facts and returns a message and a penalty. Penalties let you compute a score out of 100. Use the limits you learned for titles (about 60 characters) and descriptions (about 120-160), keeping in mind that these are guidelines, not hard limits.

Python Step 2 and 3: rules, scoring and report

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The report lists the weakest page first. Read the messages: the sale page is noindex with broken structured data, and the blog post has a long title and a canonical that disagrees with its own URL.

Step 3: ideas to extend it

  • Detect duplicate titles and descriptions across the whole set with a dictionary.
  • Check internal links against a list of known URLs and report broken ones (use the link graph from Site Architecture and URLs).
  • Verify Open Graph tags (og:title, og:image) for social sharing.
  • Check structured data required fields using the linter from Structured Data and Schema Markup.
  • Add a severity label (critical, warning, info) and output CSV or JSON.
  • Fetch live pages with urllib.request (respect robots.txt and rate limits) and run the tool on your own site.
A browser-side meta check

The preview page is minimal, so several checks fail. Add the missing tags to the code and watch them turn green.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Why does the auditor use penalties instead of only pass or fail?

    Different problems matter differently; weights let you rank pages and issues.
  2. 2. Which problem should have the highest penalty?

    Noindex removes the page from results, so it outweighs cosmetic issues.
  3. 3. Why parse HTML with HTMLParser instead of regular expressions?

    A parser follows tags and attributes properly, while regular expressions break on real-world markup.
  4. 4. What should you do before auditing live sites with your tool?

    Crawl politely so you do not overload servers or ignore the site's rules.

Summary

  • A parser turns HTML into facts; rules turn facts into weighted problems; a report ranks pages.
  • Check titles, descriptions, headings, canonicals, robots directives, images and structured data.
  • Keep penalties proportional to impact.
  • Extend the tool with duplicate detection, link checks and live fetching.

Next: Project: Content Brief with TF-IDF