Skip to content

Commit

Permalink
Cleanup method and document logic reasoning
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Nov 27, 2023
1 parent f09899f commit 1f8c4b2
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

0 comments on commit 1f8c4b2

Please sign in to comment.