This file can be downloaded at http://online24x7.de/Download/robots_txt.tar.gz
Any ideas for better handling?
Maybe the "access control" "anonymous user" rights should be implemented into this module.
It does following:
<?php
// $Id: robots.txt.module, v1.0
/**
* @file
* Simple module to generate robots.txt
*/
/**
* Implementation of hook_help().
*/
function robots_txt_help($section) {
switch ($section) {
case 'admin/modules#description':
return t('Creates a robots.txt at q=robots.txt');
case 'admin/settings/robots_txt':
return t('The following options allow you to alter the behavior of the robots.txt module.');
}
}
/**
* Implementation of hook_menu().
*/
function robots_txt_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array('path' => 'robots.txt', 'title' => t('robots.txt'),
'callback' => 'robots_txt_output',
'type' => MENU_CALLBACK,
'access' => 1);
}
return $items;
}
/**
* Implementation of hook_settings().
*/
function robots_txt_settings() {
$output .= form_group(t('Edit robots.txt as usual'),
form_textarea(t('Promotion adjustment'), 'robots.txt',variable_get('robots.txt','User-agent: *'),10,5,t('Edit as usual with Disallow')));
$output .= form_group(t('Default Settings'),
form_checkbox(t('Disallow: admin/'),'robots.txt_admin',1,variable_get('robots.txt_admin',1),t('If enabled, indexing of admin directory is disallowed.'))