DM2: Page-level SEO: intent, titles, structure and structured data

Lesson 5 of 5 · reading 15–25 minutes; practice and project time is on the module page

Structured data with JSON-LD

🎯You'll be able to

Describe a product with schema.org structured data in JSON-LD, keep it in step with the page, and check it.

🏠The everyday picture

A parcel has a printed label with the address, weight and contents in fixed boxes, so a sorting machine can read it without opening the box. Structured data is that label for a web page.

📘What it really is

<script type="application/ld+json">
{"@context": "https://schema.org", "@type": "Product", "name": "Clay tawa, 10 inch", "sku": "tawa",
 "image": "https://www.mittimart.example/img/products/tawa.svg",
 "offers": {"@type": "Offer", "price": "720.00", "priceCurrency": "INR", "availability": "https://schema.org/InStock"}}
</script>

📝A worked example

Input: the starter kulhad page's JSON-LD says "price": "520.00", while the page shows ₹480; the other product pages have none.

Steps:

  1. Write one Product block for each product page from the product's data: name equal to the page's h1, price as shown, INR, and availability.
  2. Check each block parses as JSON (for example with JSON.parse in the browser console).
  3. Run npm run test:seo.

Expected output: test 8 passes: six product pages, each with one Product block whose name and price match the page.

🌍Where it's used

📝Case scenario

A pharmacy chain's structured data was written by hand once and not updated after that. Prices in search listings were weeks old, customers complained at the counter, and the chain withdrew the markup. It came back when the JSON-LD was generated from the same price feed as the pages.

🖱️Try it

View the source of a product page on a large shop and find its JSON-LD. List the @type and three properties. Success: you can point to the price in the markup and the same price on the page.

⚠️Common mistakes

🛠️For your project

Project 3's test 8 checks the JSON-LD on each product page: valid, Product, the name matching the h1, and the price and currency matching the page.

✅Quick check

Which format is recommended for structured data?

Show the answer

JSON-LD, in a <script type="application/ld+json"> block.

What must the price in a Product's structured data match?

Show the answer

The price visitors see on the page.

← PreviousImages, alt text and pages in more than one language
ProLearners Assist