add robots.txt

This commit is contained in:
E. S. 2024-03-13 01:08:43 +00:00
parent dfc762912a
commit 65b8f9342f
5 changed files with 26 additions and 3 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
const ROUTER_VERSION = 3; const ROUTER_VERSION = 4;
const ROUTER_MC_KEY = '4in1/routes'; const ROUTER_MC_KEY = '4in1/routes';
$RouterInput = []; $RouterInput = [];

View File

@ -0,0 +1,16 @@
<?php
class ServicesHandler extends request_handler {
function GET_robots_txt() {
$txt = <<<TXT
User-agent: *
Disallow: /admin
TXT;
header('Content-Type: text/plain');
echo $txt;
exit;
}
}

View File

@ -31,6 +31,10 @@
//&-label { //&-label {
// margin-right: 4px; // margin-right: 4px;
//} //}
//.is-author, .is-title {
// color: $fg;
//}
} }
&-subtitle { &-subtitle {

View File

@ -232,10 +232,10 @@ class BookItem extends model implements FilesItemInterface {
public function getTitleHtml(): ?string { public function getTitleHtml(): ?string {
if ($this->isFolder() || !$this->author) if ($this->isFolder() || !$this->author)
return null; return null;
$buf = '<b>'.htmlescape($this->author).'</b>'; $buf = '<b class="is-author">'.htmlescape($this->author).'</b><span class="is-title">';
if (!str_ends_with($this->author, '.')) if (!str_ends_with($this->author, '.'))
$buf .= '.'; $buf .= '.';
$buf .= ' '.htmlescape($this->title); $buf .= ' '.htmlescape($this->title).'</span>';
return $buf; return $buf;
} }

View File

@ -21,6 +21,9 @@ return (function() {
'files/{'.implode(',', $files_collections).'}/' => 'collection collection=${1}', 'files/{'.implode(',', $files_collections).'}/' => 'collection collection=${1}',
'files/'.$wff.'/(\d+)/' => 'collection collection='.$wff.' folder_id=$(1)', 'files/'.$wff.'/(\d+)/' => 'collection collection='.$wff.' folder_id=$(1)',
], ],
'Services' => [
'robots.txt' => 'robots_txt',
],
'Admin' => [ 'Admin' => [
'admin/' => 'index', 'admin/' => 'index',
'admin/{login,logout,log}/' => '${1}', 'admin/{login,logout,log}/' => '${1}',