Skip to content
Snippets Groups Projects
Commit ea6430c0 authored by ale's avatar ale
Browse files

New plugin to add Sitemap link to robots.txt

parent ef67f18e
No related branches found
No related tags found
No related merge requests found
Pipeline #54186 passed
<?php
/*
* Plugin Name: A/I - Robots.txt
* Description: Customize robots.txt with per-site sitemap links
* Version: 0.0.1
* Author: Autistici/Inventati
* Author URI: https://autistici.org
*/
function ai_robots_txt_add_sitemap($output, $public) {
if ($public != '0') {
$sitemap_url = get_site_url(null, "/wp-sitemap.xml");
$output .= "\nSitemap: {$sitemap_url}\n";
}
return $output;
}
add_filter('robots_txt', 'ai_robots_txt_add_sitemap', 99, 2);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment