BYTESLIP ← Back
Knowledge Base // Tutorial 116

Add JSON-LD Structured Data to a Static HTML Site, Then Lint It With Python

Difficulty: Medium ~40 min HTML · JSON-LD · Python

WordPress plugins write structured data for you. On a hand-built site, nothing does, so your pages either carry it or they don’t. This guide shows what Google actually uses in November 2026, gives you a copy-and-paste @graph for a tutorial page and a free Android app page, and adds a small Python checker you can run in Termux before every upload.

Static page to validated structured data Four tiles: HTML page, JSON-LD graph, Python lint, and Rich Results Test. HTML PAGE JSON-LD @GRAPH PYTHON LINT RICH RESULTS TEST
Safety // Read First

Warnings

ImportantStructured data must describe what readers can see on the page. Google’s general guidelines say not to mark up hidden or misleading content, and a structured data manual action removes rich result eligibility. Never add star ratings or reviews you didn’t collect from real users.

Checklist // Before You Start

What You Need

How this was tested: The two JSON-LD blocks below passed the Schema Markup Validator with 0 errors and 0 warnings on Nov 12, 2026. The jsonld_check.py script was run with Python 3.13 and 3.14 against broken sample pages (it caught a trailing comma, a skipped breadcrumb position, a date without a timezone, and a headline that wasn’t on the page) and against a 163-page copy of a live static site.

Walkthrough // Steps 01–06

Pick types → add the graph → date it → apps → lint → confirm

All of this is plain text in your HTML files. No build tools, no plugin.

  1. Step 1: Pick the types that still do something

    Google’s list of supported structured data is the only list that matters for Google features. For a small studio site, the useful ones are:

    • Article: Google accepts Article, NewsArticle or BlogPosting. TechArticle is a schema.org subtype of Article that suits how-to pages. If you want to stick to the three types Google names, use Article. There are no required properties.
    • BreadcrumbList: needs at least two items. Google’s page says breadcrumbs in results are a desktop feature.
    • Organization: belongs on the home page (name, url, logo, sameAs links to your official profiles).
    • SoftwareApplication (or MobileApplication): for app download pages.

    Skip FAQPage and HowTo for Google. Google stopped showing HowTo rich results in September 2023 and FAQ rich results on May 7, 2026. Google says leftover markup does no harm, and other search engines may still read it, so there’s no need to rip it out.

  2. Step 2: Paste one @graph block into the head

    JSON-LD is Google’s recommended format, and it lives in one <script> tag, so your visible HTML doesn’t change. Put this in the <head>, then swap in your own URLs, names and image:

    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@graph": [
        {
          "@type": "TechArticle",
          "@id": "https://example.com/tutorials/my-guide/#article",
          "headline": "My Guide Title",
          "description": "One or two sentences that match the meta description.",
          "image": ["https://example.com/img/my-guide-1200x675.jpg"],
          "datePublished": "2026-11-19T15:16:10-10:00",
          "dateModified": "2026-11-19T15:16:10-10:00",
          "author": {"@type": "Person", "name": "Your Name", "url": "https://example.com/about"},
          "publisher": {"@type": "Organization", "name": "Example Studio", "url": "https://example.com/", "logo": "https://example.com/img/logo.png"},
          "mainEntityOfPage": "https://example.com/tutorials/my-guide/"
        },
        {
          "@type": "BreadcrumbList",
          "itemListElement": [
            {"@type": "ListItem", "position": 1, "name": "Tutorials", "item": "https://example.com/tutorials/"},
            {"@type": "ListItem", "position": 2, "name": "Development", "item": "https://example.com/tutorials/development/"},
            {"@type": "ListItem", "position": 3, "name": "My Guide Title"}
          ]
        }
      ]
    }
    </script>

    Three rules that trip people up:

    • headline should match your visible <h1>.
    • The last breadcrumb can leave out item. Google then uses the page’s own URL.
    • Article images need to be crawlable. Google recommends several high-resolution versions (at least 50,000 pixels, width × height) in 16:9, 4:3 and 1:1.
  3. Step 3: Stamp dates with a timezone

    Google’s Article docs recommend ISO 8601 dates with timezone information. Without one, Google uses Googlebot’s timezone. Get a ready-made stamp from Termux or any Linux shell:

    TZ=Pacific/Honolulu date -Iseconds

    That prints something like 2026-11-12T17:51:01-10:00. Change dateModified when you make a real change to the content, not when you fix a typo in the footer.

  4. Step 4: Mark up a free app page honestly

    For an APK download page, this validates cleanly:

    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@type": "MobileApplication",
      "name": "My App",
      "operatingSystem": "Android 8.0 or later",
      "applicationCategory": "UtilitiesApplication",
      "offers": {"@type": "Offer", "price": 0, "priceCurrency": "USD"},
      "downloadUrl": "https://example.com/downloads/my-app-1.0.apk"
    }
    </script>

    Google’s Software App docs list name, offers.price (use 0 for free) and a rating or review as required for the app rich result. If you don’t have real reviews, leave rating fields out. The markup still says clearly what the page is, but it won’t get stars, and inventing a rating risks a manual action. Use one of Google’s listed categories, like UtilitiesApplication or MultimediaApplication.

  5. Step 5: Lint every page with Python before you upload

    Save this as jsonld_check.py next to your site folder. It uses only the Python standard library, so it runs in Termux without pip.

    #!/usr/bin/env python3
    """jsonld_check.py - lint the JSON-LD in static HTML pages (Byteslip).
    Usage: python3 jsonld_check.py page.html [more.html ...]
    Finds every <script type="application/ld+json">, checks the JSON parses,
    then checks the Google-documented properties for Article, BreadcrumbList,
    Organization and SoftwareApplication nodes. Stdlib only."""
    import json, re, sys
    from datetime import datetime
    from html.parser import HTMLParser
    
    ARTICLE = {"Article", "NewsArticle", "BlogPosting", "TechArticle"}
    APP = {"SoftwareApplication", "MobileApplication", "WebApplication"}
    NO_GOOGLE_RESULT = {"FAQPage", "HowTo"}   # valid schema.org, no Google rich result now
    
    class Grab(HTMLParser):
        def __init__(self):
            super().__init__(); self.blocks = []; self.text = []; self.mode = None
        def handle_starttag(self, tag, attrs):
            a = dict(attrs)
            if tag == "script" and (a.get("type") or "").lower() == "application/ld+json":
                self.mode = "ld"; self.blocks.append("")
            elif tag in ("script", "style", "head"): self.mode = "skip"
        def handle_endtag(self, tag):
            if tag in ("script", "style", "head"): self.mode = None
        def handle_data(self, d):
            if self.mode == "ld": self.blocks[-1] += d
            elif self.mode is None: self.text.append(d)
    
    def nodes(data):
        items = data if isinstance(data, list) else [data]
        for it in items:
            if isinstance(it, dict):
                yield it
                yield from nodes(it.get("@graph", []))
    
    def types(n):
        t = n.get("@type", [])
        return set(t if isinstance(t, list) else [t])
    
    def iso_tz(v):
        try: d = datetime.fromisoformat(str(v))
        except ValueError: return "not ISO 8601"
        return None if d.tzinfo or len(str(v)) == 10 else "no timezone"
    
    def check(path):
        g = Grab(); g.feed(open(path, encoding="utf-8").read())
        visible = " ".join(" ".join(g.text).split()).lower().replace("\u2019", "'")
        out = []
        if not g.blocks: return ["no JSON-LD found"]
        for i, raw in enumerate(g.blocks, 1):
            try: data = json.loads(raw)
            except ValueError as e:
                out.append(f"block {i}: JSON error: {e}"); continue
            for n in nodes(data):
                t = types(n); label = "/".join(sorted(t)) or "(no @type)"
                if "@graph" not in n and not t: out.append(f"block {i}: node without @type")
                for x in t & NO_GOOGLE_RESULT:
                    out.append(f"note: {x} is valid schema.org but Google no longer shows a rich result for it")
                if t & ARTICLE:
                    for k in ("headline", "author", "datePublished", "image"):
                        if k not in n: out.append(f"{label}: recommended '{k}' missing")
                    for k in ("datePublished", "dateModified"):
                        if k in n and iso_tz(n[k]): out.append(f"{label}: {k} {iso_tz(n[k])}: {n[k]}")
                    h = str(n.get("headline", "")).lower().replace("\u2019", "'")
                    if h and h not in visible: out.append(f"{label}: headline not found in visible text")
                    for a in (n.get("author") if isinstance(n.get("author"), list) else [n.get("author")]):
                        if isinstance(a, dict) and not a.get("@type"): out.append(f"{label}: author has no @type")
                if "BreadcrumbList" in t:
                    items = n.get("itemListElement", [])
                    if len(items) < 2: out.append("BreadcrumbList: Google needs at least two ListItems")
                    for pos, li in enumerate(items, 1):
                        if li.get("position") != pos: out.append(f"BreadcrumbList: item {pos} has position {li.get('position')}")
                        if not li.get("name"): out.append(f"BreadcrumbList: item {pos} has no name")
                        if pos < len(items) and not li.get("item"): out.append(f"BreadcrumbList: item {pos} has no item URL")
                if t & APP:
                    offers = n.get("offers") or {}
                    if not n.get("name"): out.append(f"{label}: required 'name' missing")
                    if not isinstance(offers, dict) or "price" not in offers: out.append(f"{label}: required 'offers.price' missing (use 0 for free)")
                    if not (n.get("aggregateRating") or n.get("review")):
                        out.append(f"{label}: no aggregateRating or review, so not eligible for the app rich result (never invent one)")
                if "Organization" in t and "url" not in n and "@id" not in n:
                    out.append("Organization: add url")
        return out
    
    if __name__ == "__main__":
        if len(sys.argv) < 2: sys.exit(__doc__)
        bad = 0
        for p in sys.argv[1:]:
            problems = check(p)
            errs = [x for x in problems if not x.startswith("note:")]
            bad += bool(errs)
            print(f"{'OK  ' if not errs else 'FIX '} {p}")
            for x in problems: print("   -", x)
        sys.exit(1 if bad else 0)

    Run it on one page or a whole folder:

    python3 jsonld_check.py tutorials/my-guide/index.html
    python3 jsonld_check.py $(find . -name "*.html")

    OK lines passed. FIX lines list what to change, and note: lines are information only. It exits with code 1 if anything needs fixing, so you can put it in a pre-upload script.

  6. Step 6: Confirm with Google’s and schema.org’s validators

    The script catches structural mistakes. Then check with the tools that know the vocabulary:

    • Rich Results Test: shows which Google features the page is eligible for. Paste code before you upload, or test the live URL after.
    • Schema Markup Validator: checks every schema.org type, including ones Google ignores.
    • After deploying, use URL Inspection in Search Console to see the page the way Google sees it. Google says crawling can take days.
Pro Tip

One graph, linked by @id

Questions // FAQ

FAQ

Does structured data improve rankings?

Google says it helps it understand a page and makes the page eligible for rich results, but it doesn’t guarantee any feature. A structured data manual action affects rich results, not web ranking.

JSON-LD, Microdata or RDFa?

Google supports all three and recommends JSON-LD. It’s the easiest to keep up to date on a static site because it sits in one block instead of being spread through your HTML.

Should I delete my HowTo and FAQ markup?

You don’t have to. Google says unused structured data causes no problems in Search; it just won’t show anything. Delete it if you want lighter pages.

TechArticle or Article?

Google’s Article docs say Article objects must be based on Article, NewsArticle or BlogPosting. TechArticle is a schema.org subtype of Article, and the Schema Markup Validator accepts it. If you want to match Google’s list word for word, use Article.

Keep Reading
Sources // Verified

Official docs

Supported features list: Structured data markup that Google Search supports. Rules on visible content, manual actions, JSON-LD and @id: General structured data guidelines. Article properties, dates and images: Article structured data. Breadcrumb rules: Breadcrumb structured data. App requirements and categories: Software app structured data. Home-page organization markup: Organization structured data. HowTo end date: Changes to HowTo and FAQ rich results. FAQ end date: Search Central documentation updates.

← All Tutorials Byteslip Apps