function xmlsitemap_robotstxt in XML sitemap 2.x
Same name and namespace in other branches
- 8 xmlsitemap.module \xmlsitemap_robotstxt()
- 5.2 xmlsitemap/xmlsitemap.module \xmlsitemap_robotstxt()
- 5 xmlsitemap.module \xmlsitemap_robotstxt()
- 6.2 xmlsitemap.module \xmlsitemap_robotstxt()
- 6 xmlsitemap.module \xmlsitemap_robotstxt()
- 7.2 xmlsitemap.module \xmlsitemap_robotstxt()
Implements hook_robotstxt().
File
- ./
xmlsitemap.module, line 220 - xmlsitemap XML sitemap
Code
function xmlsitemap_robotstxt() {
if ($sitemap = XmlSitemap::loadByContext()) {
$uri = xmlsitemap_sitemap_uri($sitemap);
$path = UrlHelper::isExternal($uri['path']) ? $uri['path'] : 'base://' . $uri['path'];
$robotstxt[] = 'Sitemap: ' . Url::fromUri($path, $uri['options'])
->toString();
return $robotstxt;
}
}