drupal_add_feed

Definition

drupal_add_feed($url = NULL, $title = '')
drupal/includes/common.inc, line 192

Description

Add a feed URL for the current page.

This function can be called as long the HTML header hasn't been sent.

Parameters

$url A url for the feed.

$title The title of the feed.

Code

function drupal_add_feed($url = NULL, $title = '') {
  static $stored_feed_links = array();

  if (!is_null($url) && !isset($stored_feed_links[$url])) {
    $stored_feed_links[$url] = theme('feed_icon', $url, $title);

    drupal_add_link(array('rel' => 'alternate',
                          'type' => 'application/rss+xml',
                          'title' => $title,
                          'href' => $url));
  }
  return $stored_feed_links;
}