Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Audit the JSON-LD on your site with Python

JSON-LD, in this context, is the block of structured data inside a <script type="application/ld+json"> tag that tells search engines what a page describes: a product, an event, an organisation. Validators like the Rich Results Test check one URL at a time. That's fine during development, but it doesn't tell you what's happening across fifty templates six months after launch, when plugins have…

JSON-LD is a structured data format that provides information about web pages to search engines. It is typically contained within a script tag with the type attribute set to "application/ld+json". Validators like the Rich Results Test can check the JSON-LD for individual URLs, but this only provides a snapshot of the data at that moment.

After launch, as websites evolve with template updates and content changes, it's important to audit the JSON-LD across all pages to ensure accuracy and relevance. This post presents a Python script that automates the process of fetching a list of URLs, extracting all JSON-LD blocks, and identifying common issues that tend to arise after deployment.

These issues include invalid JSON types, multiple instances of the same block, missing entities, and events with past dates. The script is not meant to replace Google's validators but rather to provide a convenient and repeatable way to keep track of JSON-LD health over time. It's crucial to maintain accurate structured data because Google emphasizes the need for up-to-date information, warning that rich results may not be displayed if the data is no longer relevant.

The script demonstrates how to install the necessary dependencies, create a text file containing URLs, and run the audit process.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

How floating-point numbers are stored (and why 0.1 isn't exact)

Disclosure: this post was written with AI assistance and checked by the FlashKit team. Open any console and type 0.1 + 0.2 . You get 0.30000000000000004 .

  • Floating-point numbers consist of sign bit, exponent, and mantissa
  • 0.1 cannot be stored exactly due to binary representation limitations
  • 0.1 + 0.2 ≠ 0.3 due to rounding errors in floating-point arithmetic

More from Friday 27 November →