You are here

function scheduler_node_view in Scheduler 7

Same name and namespace in other branches
  1. 8 scheduler.module \scheduler_node_view()

Implements hook_node_view().

File

./scheduler.module, line 482
Scheduler publishes and unpublishes nodes on dates specified by the user.

Code

function scheduler_node_view($node, $view_mode, $langcode) {

  // If the node is going to be unpublished, then add this information to the
  // header for search engines. Only do this when the current page is the
  // full-page view of the node.
  // @see https://googleblog.blogspot.be/2007/07/robots-exclusion-protocol-now-with-even.html
  if ($view_mode == 'full' && !empty($node->unpublish_on) && node_is_page($node) && arg(2) != 'edit') {
    drupal_add_http_header('X-Robots-Tag', 'unavailable_after: ' . date(DATE_RFC850, $node->unpublish_on));
  }
}