Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
New plugin to add Sitemap link to robots.txt
· ea6430c0
ale
authored
Jun 04, 2023
ea6430c0
Hide whitespace changes
Inline
Side-by-side
robots-txt.php
0 → 100644
View file @
ea6430c0
<?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
.
=
"
\n
Sitemap:
{
$sitemap_url
}
\n
"
;
}
return
$output
;
}
add_filter
(
'robots_txt'
,
'ai_robots_txt_add_sitemap'
,
99
,
2
);