diff --git a/modules/mod_breadcrumbs/tmpl/default.php b/modules/mod_breadcrumbs/tmpl/default.php index 5cf0607150e6d..bc9a5715269f7 100644 --- a/modules/mod_breadcrumbs/tmpl/default.php +++ b/modules/mod_breadcrumbs/tmpl/default.php @@ -67,11 +67,12 @@ 'https://schema.org', '@type' => 'BreadcrumbList', - '@id' => Uri::root() . '#/schema/BreadcrumbList/' . (int) $module->id, + '@id' => Uri::getInstance()->toString() . '#breadcrumb', 'itemListElement' => [] ]; diff --git a/plugins/system/schemaorg/src/Extension/Schemaorg.php b/plugins/system/schemaorg/src/Extension/Schemaorg.php index 8af09bb76109c..1009fc4bde05d 100644 --- a/plugins/system/schemaorg/src/Extension/Schemaorg.php +++ b/plugins/system/schemaorg/src/Extension/Schemaorg.php @@ -380,14 +380,16 @@ public function onBeforeCompileHead(BeforeCompileHeadApplicationEvent $event): v $baseSchema['@graph'][] = $webSiteSchema; - // Add WebPage - $webPageId = $domain . '#/schema/WebPage/base'; + // Add WebPage. Unlike the Organization and WebSite nodes above, a WebPage is one node per page, + // so its @id is derived from the page URL rather than being a site-wide constant. + $webPageUrl = Uri::getInstance()->toString(); + $webPageId = $webPageUrl . '#webpage'; $webPageSchema = []; $webPageSchema['@type'] = 'WebPage'; $webPageSchema['@id'] = $webPageId; - $webPageSchema['url'] = htmlspecialchars(Uri::getInstance()->toString()); + $webPageSchema['url'] = htmlspecialchars($webPageUrl); $webPageSchema['name'] = $app->getDocument()->getTitle(); $webPageSchema['description'] = $app->getDocument()->getDescription(); $webPageSchema['isPartOf'] = ['@id' => $webSiteId];