Sub topic 8
Marking up ranked lists with schema.org ItemList
This chapter assumes you can read basic HTML and JSON, and that you know how crawlers fetch and index pages. It covers how to describe a ranked list in structured data, how to keep that data in step with the visible page, and the errors that make markup useless or harmful.
What ItemList does
Structured data is machine-readable text that describes what a page contains. The most common format is JSON-LD, a block of JSON placed in a <script> tag. The vocabulary comes from schema.org, a shared set of type names such as ItemList and ListItem.
An ItemList states that the page contains an ordered or unordered list of things. Each entry is a ListItem with a position, a name and usually a url. For a best-of page, this gives a parser the ranking in an explicit form. It does not have to infer the order from headings or numbering.
Keep expectations realistic. No search or AI vendor has promised that ItemList markup earns citations or a better ranking. Treat it as a clear statement of what is already on the page. The visible content (headings, table, text) is still what readers and retrieval systems rely on most. Markup helps a system that chooses to read it, and it costs little to add. Check each vendor's current documentation for what it supports.
Where markup fits in the page
Structured data comes late in the dependency chain for this topic. You first choose criteria, write the evidence and build a readable table. Only then do you describe the result. The markup is a summary of the page, so it cannot be written well before the page exists.
The basic structure
Here is a minimal block for a two-item list. It is the same shape used throughout this tutorial.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "ItemList",
"name": "Best project management tools for small teams",
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"name": "Tool A",
"url": "https://example.com/best-project-tools#tool-a"
},
{
"@type": "ListItem",
"position": 2,
"name": "Tool B",
"url": "https://example.com/best-project-tools#tool-b"
}
]
}
</script>The properties do the following:
| Property | Purpose | Notes |
|---|---|---|
| `@context` | Names the vocabulary | Always `https://schema.org` here |
| `@type` | Declares the kind of thing | `ItemList` on the outer object, `ListItem` on each entry |
| `name` | Title of the list | Match the page's main heading or list heading |
| `itemListElement` | The entries | An array of `ListItem` objects |
| `position` | Rank in the list | Integers starting at 1, no gaps or repeats |
| `url` | Where the item is described | Should resolve to the matching section or page |
Each url points to a place on the site that describes that item. In the example, the fragment #tool-a must match an element with id="tool-a" on the page. A fragment that matches nothing sends the reader to the top of the page, which defeats the purpose.
Ordered or unordered
ItemList has an optional property, itemListOrder. It takes values such as https://schema.org/ItemListOrderAscending, https://schema.org/ItemListOrderDescending or https://schema.org/ItemListUnordered. Use it when the meaning of the order is not obvious.
- A "top 10" ranked by your judgement is a ranking. The positions carry meaning.
- A list sorted alphabetically is not a ranking. Say so with
ItemListUnordered, and say so in the visible text.
This matters for honesty as well as for parsers. If you sort alphabetically but publish positions 1 to 10, a machine will read tool number 1 as your top pick.
Describing items with more detail
A ListItem can hold a full description of the thing instead of only a name and URL. You do this with the item property, which holds a nested object such as a Product or SoftwareApplication.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "ItemList",
"name": "Best project management tools for small teams",
"itemListOrder": "https://schema.org/ItemListOrderDescending",
"numberOfItems": 2,
"itemListElement": [
{
"@type": "ListItem",
"position": 1,
"item": {
"@type": "SoftwareApplication",
"name": "Tool A",
"url": "https://example.com/best-project-tools#tool-a",
"applicationCategory": "BusinessApplication"
}
},
{
"@type": "ListItem",
"position": 2,
"item": {
"@type": "SoftwareApplication",
"name": "Tool B",
"url": "https://example.com/best-project-tools#tool-b",
"applicationCategory": "BusinessApplication"
}
}
]
}
</script>Add detail only when the page shows the same detail. Do not put prices, ratings or review counts in markup unless they appear on the page and you can back them up. Invented or unsupported values are the fastest way to turn helpful markup into a trust problem. Search engines also have guidelines on which rich result types are allowed for which content. Read them before adding review or rating properties, especially to a list you wrote yourself.
Keeping markup and page in agreement
The rule is simple. The markup must describe what a visitor sees. Four things should agree:
- The names of the items, spelled the same way.
- The order, and therefore the positions.
- The number of items.
- The URLs, each leading to the relevant part of the page.
Disagreement usually appears after an edit. Someone moves Tool C above Tool A in the visible list and forgets the JSON-LD. The markup now states a ranking the page no longer shows. This is the most common failure with ItemList, and it is why markup should be part of the maintenance routine in the freshness chapter.
Two ways to reduce drift:
- Generate the JSON-LD from the same data source that renders the list, such as a template or a content file, so one edit changes both.
- Run an automated check in your build or publishing process.
A simple position check
The script below reads a saved HTML page, extracts each JSON-LD block, and confirms that the ItemList positions run from 1 to n without gaps. It catches deleted or duplicated entries.
import json
import re
import sys
html = open(sys.argv[1], encoding="utf-8").read()
blocks = re.findall(
r'<script type="application/ld\+json">(.*?)</script>', html, re.S
)
for raw in blocks:
data = json.loads(raw)
if data.get("@type") == "ItemList":
positions = [e["position"] for e in data["itemListElement"]]
expected = list(range(1, len(positions) + 1))
assert positions == expected, f"positions out of order: {positions}"
print(f"ItemList ok: {len(positions)} items")Run it with python check_itemlist.py saved-page.html. It prints ItemList ok: 2 items for the first example above. It checks positions only. It does not compare names with the visible text, so add that comparison if your pages change often.
The script has limits you should know about:
- It handles a single top-level object. A block that is a JSON array, or that uses
@graphto hold several objects, would makedata.getfail or find nothing. - It assumes the exact attribute order
type="application/ld+json"in the script tag. Extra attributes would hide the block from the regular expression. - It reads the HTML as served. If your page builds its markup with JavaScript in the browser, test the rendered page instead.
Common errors
| Error | Effect | Fix |
|---|---|---|
| JSON syntax mistakes, such as a trailing comma or unescaped quote | The whole block is ignored | Validate the JSON before publishing |
| Positions start at 0 or skip numbers | Order is ambiguous | Number from 1 with no gaps |
| Markup lists items that are not on the page | Page and markup disagree | Remove the extra items or add them to the page |
| Fragment URLs with no matching `id` | Links land at the top of the page | Add matching `id` attributes to headings |
| Ratings or prices in markup but not on the page | Possible guideline violation and lost trust | Show the data on the page or remove it |
| Markup added only by a script that runs late | Some crawlers may not see it | Put the JSON-LD in the served HTML |
| Duplicate ItemList blocks from a theme and a plugin | Conflicting lists | Keep one source of truth |
After publishing, use a structured data testing tool, such as the Schema Markup Validator or the testing tool offered by your search engine, to confirm that the block parses. A passing validation means the syntax is valid. It does not mean the list is accurate or that any system will use it.
Relationship to the rest of the page
ItemList markup supports the page structure but does not replace it. Keep the visible parts in place:
- A heading that states the list's purpose and the date it was checked.
- A comparison table with a caption, column headers and row headers, as shown earlier in this tutorial.
- A short statement of how the ranking was decided, and any relationship you have with listed products.
If your own product is on the list, markup treats it like any other entry. It must have no special flag or position that the visible text does not explain. The disclosure belongs on the page, where readers see it.
Summary of working rules
- Use
ItemListwithListItementries for lists that have a meaningful order. - Number positions from 1 with no gaps, and match the visible order.
- Give every item a URL that resolves to a real section of the page.
- Add nested item details only when the page shows them.
- Generate markup from the same source as the visible list.
- Validate after each change and re-check after each edit.
Exercise
A colleague moves "Tool C" from position 3 to position 1 in the visible list on a best-of page, but does not touch the JSON-LD block. Name two things on the page that now disagree, and give two ways to stop this from happening again.
Show answer
The names at each position disagree (the markup still shows Tool A first and Tool C third), and the order the markup states no longer matches the ranking visitors see. The fragment URLs may also point to sections in a different order, but the key mismatch is the ranking. To prevent it, generate both the visible list and the JSON-LD from a single data source so one edit changes both, and add an automated check in the publishing process that compares the markup's names and positions with the rendered list. Adding markup checks to the page maintenance routine also helps.
Exercise
The position-check script reports no output at all for a page that has a valid ItemList block. List two reasons the script might miss it.
Show answer
The script script's regular expression requires the script tag to be exactly <script type="application/ld+json">, so a block with extra attributes (for example an id or data- attribute) will not match. Also, if the markup is inserted by JavaScript in the browser, it is not in the saved HTML, so nothing is found. A third possibility is that the block holds the list inside @graph or as a JSON array, so the top-level @type is not ItemList.