Skip to content

feat: Add LodgingBusiness schema type with hospitality-specific fields#29

Open
andreas-straub wants to merge 3 commits intoOperation-Nation:mainfrom
andreas-straub:feature/add-lodging-schema-types
Open

feat: Add LodgingBusiness schema type with hospitality-specific fields#29
andreas-straub wants to merge 3 commits intoOperation-Nation:mainfrom
andreas-straub:feature/add-lodging-schema-types

Conversation

@andreas-straub
Copy link
Copy Markdown

@andreas-straub andreas-straub commented Apr 2, 2026

Summary

Adds a dedicated LodgingBusiness schema type with hospitality-specific fields that were missing from the existing LocalBusiness type. Previously, lodging subtypes (Hotel, Bed And Breakfast, Hostel, Motel) were listed in the LocalBusiness dropdown but used the generic LocalBusiness pattern, which lacks properties essential for accommodation structured data.

New Schema Types

All schema.org LodgingBusiness subtypes:

  • LodgingBusiness (parent type)
  • BedAndBreakfast
  • Campground
  • Hostel
  • Hotel
  • Motel
  • Resort
  • VacationRental

New Hospitality-Specific Fields

These fields are available in addition to all existing LocalBusiness fields (address, geo, openingHours, sameAs, etc.):

Field Type Description
checkinTime string (TimePicker) Check-in time, e.g. "14:00" — uses the same TimePicker component as openingHours
checkoutTime string (TimePicker) Check-out time, e.g. "11:00"
petsAllowed boolean Whether pets are allowed
numberOfRooms number Total number of rooms
email string Contact email
amenityFeature array List of LocationFeatureSpecification items (name + boolean value)
starRating object Rating with ratingValue, bestRating (default "5"), worstRating (default "1")
currenciesAccepted string e.g. "EUR"
paymentAccepted string e.g. "Cash, Credit Card"
alternateName string Alternative business name
description text Business description

Motivation

Schema.org's LodgingBusiness type and its subtypes are widely used in Google Travel, Hotel Search, and rich results for accommodations. Properties like checkinTime, checkoutTime, petsAllowed, and amenityFeature are essential for these rich results but were not available in the generic LocalBusiness schema type.

Changes

  • New pattern file: src/patterns/lodgingBusiness.ts — single pattern covering all lodging subtypes (consistent with how localBusiness.ts covers all LocalBusiness subtypes)
  • New schema type: src/schemas/types/lodgingBusiness/ with dropdown selector, type list, and full field definitions including TimePicker for check-in/check-out times
  • Updated detectSchemaType.ts: Routes lodging types to dedicated pattern (checked before LocalBusiness)
  • Updated config.ts: Added lodgingBusiness to schemaTypeNames
  • Updated schemas/types/index.ts: Registered new lodgingBusiness type
  • Updated localBusinessTypeList.ts: Removed lodging types (now in dedicated list)

Breaking Change Note

Existing documents that used lodging types (Hotel, Bed And Breakfast, Hostel, Motel, Lodging Business) under the LocalBusiness schema type will now be matched by the new LodgingBusiness pattern instead. The new pattern includes all fields from LocalBusiness plus the hospitality-specific fields, so no data is lost. However, the JSON-LD output will now include additional empty fields if they were not previously filled in. Existing field values (name, address, geo, telephone, etc.) will continue to render correctly.

Backward Compatibility

  • Existing LocalBusiness schemas for non-lodging types continue to work unchanged
  • The customSchema config system (partial/full) works with the new type
  • New lodgingBusiness key added to schemaTypeNames for renaming support

andreas-straub and others added 3 commits April 3, 2026 00:04
Add dedicated schema type for lodging/hospitality businesses with fields
that are specific to accommodations: checkinTime, checkoutTime, petsAllowed,
numberOfRooms, amenityFeature, starRating, email, currenciesAccepted, and
paymentAccepted.

Includes support for the following schema.org types:
- LodgingBusiness (parent type)
- BedAndBreakfast
- Hotel
- Hostel
- Motel
- Resort
- VacationRental

Previously, these types were listed under LocalBusiness but used the generic
LocalBusiness pattern which lacks hospitality-specific properties. This change
gives them a dedicated schema type with proper fields while keeping the same
base properties (address, geo, openingHours, sameAs) from LocalBusiness.

Changes:
- New patterns: lodgingBusiness.ts, bedAndBreakfast.ts, hotel.ts, vacationRental.ts
- New schema type: lodgingBusiness with LodgingBusinessListSelect dropdown
- Updated detectSchemaType to route lodging types to dedicated pattern
- Updated config with lodgingBusiness schema type name
- Moved lodging types from localBusinessTypeList to dedicated list

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add petsAllowed and numberOfRooms to base lodgingBusiness pattern
  (fixes silent field stripping from JSON-LD output)
- Remove dead-code sub-type pattern files (bedAndBreakfast, hotel,
  vacationRental) — base pattern covers all subtypes, consistent
  with how localBusiness handles its subtypes
- Remove non-standard VacationRental type (not in schema.org),
  add Campground (valid schema.org LodgingBusiness subtype)
- Add bestRating/worstRating to starRating for proper Google
  rich result rendering
- Use TimePicker component for checkinTime/checkoutTime (consistent
  with openingHours handling, enforces HH:MM format)
- Fix @type from hardcoded 'LodgingBusiness' to 'string' (consistent
  with localBusiness pattern convention)
- Add schema.org reference comment to lodgingBusinessTypeList
- Remove trailing commas from pattern file for style consistency

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
VacationRental (https://schema.org/VacationRental) is a stable
Schema.org type inheriting from LodgingBusiness. It was incorrectly
removed in the previous commit. Re-added to the lodging type list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant