You are here

function copyprevention_robotstxt in Copy Prevention 8

Same name and namespace in other branches
  1. 7 copyprevention.module \copyprevention_robotstxt()

Implements hook_robotstxt().

File

./copyprevention.module, line 109
Main file for Copy Prevention module.

Code

function copyprevention_robotstxt() {
  $copyprevention_images_search = array_filter(\Drupal::configFactory()
    ->getEditable('copyprevention.settings')
    ->get('copyprevention_images_search'));
  if (array_key_exists('robotstxt', $copyprevention_images_search)) {
    return [
      '#Copy Prevention: protect/hide images from search engines indexing',
      'Disallow: *.jpg',
      'Disallow: *.JPG',
      'Disallow: *.jpeg',
      'Disallow: *.JPEG',
      'Disallow: *.png',
      'Disallow: *.PNG',
      'Disallow: *.gif',
      'Disallow: *.GIF',
    ];
  }
  return [];
}