Dev.to WebDev 🛠 Dev 👁 0 📖 3 min read

Audit the on-page SEO of every page on your site for about a dollar

On-page SEO problems are rarely clever. They are a title that got truncated, a page somebody set to noindex during a redesign and forgot, a template that ships without a meta description, forty product images with no alt

On-page SEO problems are rarely clever. They are a title that got truncated, a page somebody set to noindex during a redesign and forgot, a template that ships without a meta description, forty product images with no alt text. Finding them is not hard. Finding them on every page is tedious, which is why it does not get done.

This walkthrough audits a whole site in two steps: list every URL, then check each one.

Disclosure: I built the two tools used in this article. They are paid tools, priced per result.

Step 1: every URL, from the sitemap

Your sitemap already lists your pages. The Sitemap URL Extractor reads robots.txt to find the sitemaps, follows sitemap index files, and returns one record per URL:

{
    "sites": ["https://www.example.com"],
    "urlExcludes": ["/tag/", "/author/"]
}

urlExcludes drops the archive pages you do not care about. On a documentation site I tested, it returned 4,247 URLs in 6 seconds.

Step 2: check each page

The On-Page SEO Checker reads each page once and reports what it finds, a list of issues in plain English, and a score from 0 to 100:

{
    "url": "https://www.example.com/pricing",
    "score": 81,
    "issues": [
        "The page has no meta description.",
        "The page has no structured data (JSON-LD)."
    ],
    "title": "Pricing | Example",
    "titleLength": 17,
    "metaDescription": null,
    "canonicalUrl": "https://www.example.com/pricing",
    "noindex": false,
    "h1Count": 1,
    "wordCount": 612,
    "imageCount": 9,
    "imagesMissingAlt": 0,
    "internalLinkCount": 31,
    "externalLinkCount": 4
}

To give a feel for the scoring, here is what it said about four real pages when I ran it:

Page Score What it flagged
apify.com 100 nothing
wordpress.org/about 92 meta description of 357 characters; no structured data
github.com 84 title of 70 characters; long meta description; no structured data
example.com 38 no description, no H1, short title, no canonical, 25 words of text, and more

What is checked

Severity Issue
High Set to noindex; no title; no meta description; no H1; not on HTTPS
Medium Title over 60 or under 15 characters; no viewport tag; no canonical, or a canonical pointing elsewhere; under 200 words; images without alt text; unreadable structured data
Low Meta description over 160 or under 50 characters; more than one H1; no declared language; incomplete Open Graph tags; no structured data; the address redirects

High issues take 15 points off, medium 8 and low 4.

Both steps in Python

from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")

sitemap = client.actor("properscraper/sitemap-url-extractor").call(
    run_input={"sites": ["https://www.example.com"]}
)
urls = [item["url"] for item in client.dataset(sitemap["defaultDatasetId"]).iterate_items()]

audit = client.actor("properscraper/on-page-seo-checker").call(run_input={"urls": urls})
pages = list(client.dataset(audit["defaultDatasetId"]).iterate_items())

for page in sorted(pages, key=lambda p: p["score"])[:20]:
    print(page["score"], page["url"])
    for issue in page["issues"]:
        print("   -", issue)

That prints your twenty worst pages with what to fix on each.

Three findings worth looking for first

  1. noindex on pages that should rank. Filter for noindex: true. This is the one that costs real traffic, and it is usually an accident.
  2. Canonicals pointing somewhere else. The checker flags any page whose canonical link is a different address. Sometimes that is intended; often it is a template bug that tells search engines to ignore the page.
  3. The same issue on every page of one type. If all 300 product pages lack a meta description, that is one template fix, not 300 edits. Group the results by URL pattern before you start fixing.

What this does not measure

It checks what is on the page as the server sends it. It does not measure loading speed, backlinks, rankings or keyword targeting, and it does not run JavaScript, so tags added by a script afterwards are not seen. The score is a guide to hygiene, not a prediction of where you will rank.

Cost

Listing URLs costs $0.05 per 1,000 and auditing costs $1 per 1,000 pages. A 1,000-page site is about $1.05 in all; pages that could not be read are not charged.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.