Skip to content

Map itemprop meta tags to JSON-LD. - #124

Merged
mworrell merged 3 commits into
masterfrom
yt-meta-itemprop-3
Jun 30, 2026
Merged

mworrell merged 3 commits into
masterfrom
yt-meta-itemprop-3

Conversation

@mworrell

Copy link
Copy Markdown
Member

This pull request adds support for extracting and normalizing JSON-LD data and HTML microdata (using itemscope, itemtype, itemid, and itemprop) into JSON-LD-style maps in the z_url_metadata module. The metadata extraction now returns a json_ld property containing all decoded JSON-LD blocks and normalized microdata, making it easier to work with structured data from web pages. The changes include updates to the metadata structure, extraction logic, property access, and comprehensive tests for these features.

JSON-LD and Microdata Extraction:

  • Added extraction and normalization of JSON-LD and HTML microdata into a new json_ld property in the metadata structure, with support for both <script type="application/ld+json"> blocks and itemscope-based microdata. Microdata is normalized to JSON-LD maps, with schema.org types using "https://schema.org" as @context. (F8036545L541R1028, [1] [2] [3] [4]

  • Updated the p/2 property accessor and metadata type definitions to support the new json_ld property. [1] [2] [3]

HTML Attribute and Metadata Handling:

  • Added support for recognizing itemid, itemprop, itemscope, and itemtype as valid HTML attributes to enable correct parsing of microdata.

  • Improved handling of meta tag property names by normalizing certain property names to lower case for consistency (e.g., datePublisheddatepublished).

Documentation and Testing:

  • Updated the README.md to document how to access the new json_ld property and describe the normalization process for microdata.

  • Added comprehensive tests for extracting and normalizing JSON-LD and microdata, including cases for YouTube video metadata, nested microdata, and JSON-LD scripts.

Dependencies:

  • Added jsxrecord as a dependency for decoding JSON-LD data.

Copilot AI review requested due to automatic review settings June 30, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mworrell
mworrell merged commit 275e493 into master Jun 30, 2026
3 checks passed
@mworrell
mworrell deleted the yt-meta-itemprop-3 branch June 30, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants