diff --git a/lib/BurguillosInfo.pm b/lib/BurguillosInfo.pm index 708cd87..f9f4c06 100644 --- a/lib/BurguillosInfo.pm +++ b/lib/BurguillosInfo.pm @@ -29,6 +29,7 @@ sub startup ($self) { # Normal route to controller $r->get('/')->to('Page#index'); $r->get('/sitemap.xml')->to('Sitemap#sitemap'); + $r->get('/robots.txt')->to('Robots#robots'); # $r->get('/:post')->to('Page#post'); $r->get('/stats')->to('Metrics#stats'); diff --git a/lib/BurguillosInfo/Controller/Robots.pm b/lib/BurguillosInfo/Controller/Robots.pm new file mode 100644 index 0000000..d572873 --- /dev/null +++ b/lib/BurguillosInfo/Controller/Robots.pm @@ -0,0 +1,14 @@ +package BurguillosInfo::Controller::Robots; +use Mojo::Base 'Mojolicious::Controller', '-signatures'; + +sub robots($self) { + my $robots_txt = <<"EOF"; +Sitemap: @{[$self->config('base_url')]}/sitemap.xml + +User-Agent: * +Disallow: /stats +Disallow: /stats/* +EOF + $self->render(text => $robots_txt, format => 'txt'); +} +1; diff --git a/public/robots.txt b/public/robots.txt deleted file mode 100644 index c5ca693..0000000 --- a/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -User-Agent: * -Disallow: /stats -Disallow: /stats/*