From e8d1c6fc3aec39a8390ce7a106744cba09cf32df Mon Sep 17 00:00:00 2001 From: Seaton Jiang Date: Sat, 22 May 2021 09:08:37 +0800 Subject: [PATCH] feat: robots.txt add sitemap rule (#234) --- inc/theme-options.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/theme-options.php b/inc/theme-options.php index d8f2afd..c9c34ba 100644 --- a/inc/theme-options.php +++ b/inc/theme-options.php @@ -3,19 +3,21 @@ * 主题选项 * @author Seaton Jiang * @license MIT License - * @version 2021.05.18 + * @version 2021.05.22 */ function getrobots() { $site_url = parse_url(site_url()); + $web_url = get_bloginfo('url'); $path = (!empty($site_url['path'])) ? $site_url['path'] : ''; $robots = "User-agent: *\n\n"; $robots .= "Disallow: $path/wp-admin/\n"; $robots .= "Disallow: $path/wp-includes/\n"; $robots .= "Disallow: $path/wp-content/plugins/\n"; - $robots .= "Disallow: $path/wp-content/themes/\n"; + $robots .= "Disallow: $path/wp-content/themes/\n\n"; + $robots .= "Sitemap: $web_url/wp-sitemap.xml\n"; return $robots; }