diff --git a/packages/framework/src/Framework/Features/XmlGenerators/SitemapGenerator.php b/packages/framework/src/Framework/Features/XmlGenerators/SitemapGenerator.php index 89e0b2cbc6e..0fb0f0e7663 100644 --- a/packages/framework/src/Framework/Features/XmlGenerators/SitemapGenerator.php +++ b/packages/framework/src/Framework/Features/XmlGenerators/SitemapGenerator.php @@ -110,12 +110,13 @@ protected function resolveRouteLink(Route $route): string { $baseUrl = Config::getNullableString('hyde.url'); - $canUseQualifiedUrl = filled($baseUrl) && ! str_starts_with($baseUrl, 'http://localhost'); + if (! filled($baseUrl) || str_starts_with($baseUrl, 'http://localhost')) { + // While the sitemap spec requires a full URL, we rather fall back + // to using relative links instead of using localhost links. - if ($canUseQualifiedUrl) { + return $route->getLink(); + } else { return Hyde::url($route->getOutputPath()); } - - return $route->getLink(); } }