Skip to content

Commit

Permalink
Add gptbot
Browse files Browse the repository at this point in the history
  • Loading branch information
szepeviktor committed Sep 2, 2023
1 parent 86fd3f9 commit 9ef07fc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
22 changes: 22 additions & 0 deletions mu-plugins/_robots-gptbot.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/*
* Plugin Name: Disallow GPTBot
* Plugin URI: https://platform.openai.com/docs/gptbot
*/

add_filter(
'robots_txt',
static function ($output, $is_public) {
$lines = [
'User-agent: GPTBot',
'Disallow: /',
];
if (!$is_public) {
return $output;
}
return implode("\n", $lines) . "\n\n" . $output;
},
-1,
2
);
8 changes: 4 additions & 4 deletions mu-plugins/_robots-oszkbot.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@

add_filter(
'robots_txt',
static function ($output, $isPublic) {
static function ($output, $is_public) {
$lines = [
'User-agent: OSZKbot',
'Disallow: /',
];
if ($isPublic) {
return implode("\n", $lines) . "\n\n" . $output;
if (!$is_public) {
return $output;
}
return $output;
return implode("\n", $lines) . "\n\n" . $output;
},
-1,
2
Expand Down

0 comments on commit 9ef07fc

Please sign in to comment.