Commit 4e27b4a1 authored by amateescu's avatar amateescu

Ensure a proper sitemap link for the robotstxt module.

parent 4d081c06
......@@ -12,6 +12,7 @@
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\SafeMarkup;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Render\Element;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Entity\EntityInterface;
......@@ -219,7 +220,8 @@ function xmlsitemap_modules_uninstalled(array $modules) {
function xmlsitemap_robotstxt() {
if ($sitemap = XmlSitemap::loadByContext()) {
$uri = xmlsitemap_sitemap_uri($sitemap);
$robotstxt[] = 'Sitemap: ' . Url::fromUri($uri['path'], $uri['options'])->toString();
$path = UrlHelper::isExternal($uri['path']) ? $uri['path'] : 'base://' . $uri['path'];
$robotstxt[] = 'Sitemap: ' . Url::fromUri($path, $uri['options'])->toString();
return $robotstxt;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment