- 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. - 🇷🇺Russia walkingdexter
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?
Product variation URLs depend on the parent product:
http://example.com/product/{commerce_product}?v={commerce_product_variation}
https://www.drupal.org/project/commerce/issues/2674888 →
https://www.drupal.org/project/commerce/issues/3025860 →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.I thought about it, but now I think it's better to use a simple solution. In a quick search, I couldn't find any other examples similar to product variations. So for now we have one entity type that requires special treatment.
-
walkingdexter →
authored 87c9cf46 on 4.x
Issue #3458079 by iseeaflyingcrane, walkingdexter, gbyte: Sitemap doesn'...
-
walkingdexter →
authored 87c9cf46 on 4.x
Automatically closed - issue fixed for 2 weeks with no activity.