Skip to content

Align Reviews schema with approved Schema 2.0 mappings #220

Description

@eleshar

Overview

Align the Reviews extension schema output with the approved Tour Operator Schema 2.0 mappings and fix the current Review schema defects.

Approved mapping source:
https://docs.google.com/document/d/1UVfrdgR1o2A-5YuyMbY6Bxevy3EXYfOkj-p6dwXFxMA/edit?tab=t.l9k66a4nq8kl

Current schema file:
https://github.com/lightspeedwp/to-reviews/blob/develop/classes/class-to-review-schema.php

Delivery Decision

  • Create a new implementation branch from this repository's update-2.2 branch.
  • Keep this issue focused on Reviews schema only.

Scope

Update LSX_TO_Schema_Review so Review posts emit approved Review schema output without privacy leaks, invalid properties, or duplicate-key overwrites.

Tasks

  • Create a new branch from update-2.2 for this work.
  • Keep @type as Review.
  • Update @id to a unique review hash, for example #/schema/review/{post_id}.
  • Remove duplicate $review_author assignment.
  • Map reviewer_name to author.name.
  • Remove reviewer_email from public JSON-LD output to avoid exposing guest email addresses.
  • Keep headline, datePublished, dateModified, commentCount, mainEntityOfPage, and reviewBody where valid.
  • Correct reviewRating.ratingValue to use the actual rating value.
  • Correct reviewRating.bestRating to the scale maximum, expected 5.
  • Add reviewRating.worstRating, expected 1.
  • Fix duplicate itemReviewed array keys so tour and accommodation relationships are not overwritten.
  • Map related tours from tour_to_review to itemReviewed nodes typed as TouristTrip.
  • Map related accommodation from accommodation_to_review to itemReviewed nodes typed as LodgingBusiness.
  • Merge multiple reviewed items into one itemReviewed value without duplicate PHP keys.
  • Review date_of_visit_start / date_of_visit_end; either emit a valid ISO 8601 temporalCoverage interval or map as additionalProperty labelled Date of Visit.
  • Replace invalid reviewSection output with about or remove it if no reliable mapping is available.
  • Map destination relationships to spatialCoverage using TouristDestination, not inconsistent Country / State typing.
  • Add missing url for the Review node.
  • Keep publisher output from Yoast site_represents_reference where available.
  • Add or update tests/manual validation for one populated Review post.

Acceptance Criteria

  • Review posts emit valid Review schema aligned with the approved mapping.
  • Public JSON-LD does not expose reviewer email addresses.
  • reviewRating uses ratingValue, bestRating, and worstRating correctly.
  • Tour and accommodation reviewed items are both preserved without duplicate-key overwrites.
  • Related tours use TouristTrip; related accommodation uses LodgingBusiness.
  • Invalid reviewSection usage is removed or replaced with a valid mapping.
  • Schema validates against the agreed structured data QA approach.

Out Of Scope

  • Tour, Accommodation, and Destination schema in the core Tour Operator plugin.
  • Team schema updates.
  • Specials schema updates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions