Sitemap doesn't include product variation

Created on 30 June 2024, 7 months ago
Updated 1 July 2024, 7 months ago

Problem/Motivation

Hello, the simple xml module doesn't seem to allow product variation to be indexed. Can this be included? Each product variation has its own url and should be indexed.

Thank you!

Feature request
Status

Active

Version

4.1

Component

Code

Created by

🇺🇸United States iseeaflyingcrane

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @iseeaflyingcrane
  • First commit to issue fork.
  • Assigned to gbyte
  • 🇷🇺Russia walkingdexter

    @iseeaflyingcrane Thanks for the issue! This is a valid point.

    The reason for this behavior is that product variation does not have a canonical link template. However, if an entity doesn't have a canonical template, it can still have a canonical link. EntityHelper::supports() excludes entities that can be successfully added to the sitemap.

    @gbyte Maybe we should support all content entity types? We can move entity types without a canonical link template to a separate table on the /admin/config/search/simplesitemap/entities page and warn users about possible errors.

  • 🇩🇪Germany gbyte Berlin

    I don't use commerce - what would the canonical link of a product variation be and why does it not have a canonical link template?

    In \Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGenerator::processEntity we get the entity's URL by calling $entity->toUrl(); which in turn seems to assume a canonical path and if not given, the form edit path - see \Drupal\Core\Entity\EntityBase::toUrl.

    Do you mean to allow all content entities and then try-catch around the $entity->toUrl(); block if no URL is returned? Feel free to experiment with this.

Production build 0.71.5 2024