You are here

function robotstxt_robots in RobotsTxt 5

Same name and namespace in other branches
  1. 6 robotstxt.module \robotstxt_robots()
  2. 7 robotstxt.module \robotstxt_robots()

Show the robots.txt file.

1 string reference to 'robotstxt_robots'
robotstxt_menu in ./robotstxt.module
Defines the robots.txt path as a callback.

File

./robotstxt.module, line 66

Code

function robotstxt_robots() {
  $content = array();
  $content[] = _robotstxt_get_content();

  // Hook other modules for adding additional lines.
  if ($additions = module_invoke_all('robotstxt')) {
    $content = array_merge($content, $additions);
  }

  // Trim any extra whitespace and filter out empty strings.
  $content = array_map('trim', $content);
  $content = array_filter($content);
  drupal_set_header('Content-type: text/plain');
  echo implode("\n", $content);
  exit;
}