Error message

You are browsing documentation for drupal 7.x, which is not supported anymore. Read the updated version of this page for drupal 11.x (the latest version).

function drupal_add_feed

Adds a feed URL for the current page.

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

Parameters

$url: An internal system path or a fully qualified external URL of the feed.

$title: The title of the feed.

9 calls to drupal_add_feed()
aggregator_page_category in modules/aggregator/aggregator.pages.inc
Page callback: Displays all the items aggregated in a particular category.
aggregator_page_last in modules/aggregator/aggregator.pages.inc
Page callback: Displays the most recent items gathered from any feed.
blog_page_last in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of all users.
blog_page_user in modules/blog/blog.pages.inc
Menu callback; displays a Drupal page containing recent blog entries of a given user.
DrupalAddFeedTestCase::testBasicFeedAddNoTitle in modules/simpletest/tests/common.test
Test drupal_add_feed() with paths, URLs, and titles.

... See full list

File

includes/common.inc, line 368

Code

function drupal_add_feed ($url = NULL, $title = '') {
 $stored_feed_links =& drupal_static (__FUNCTION__, array());
 if (isset($url)) {
 $stored_feed_links[$url] = theme ('feed_icon', array(
 'url' => $url,
 'title' => $title,
 ));
 drupal_add_html_head_link (array(
 'rel' => 'alternate',
 'type' => 'application/rss+xml',
 'title' => $title,
 // Force the URL to be absolute, for consistency with other <link> tags
 // output by Drupal.
'href' => url ($url, array(
 'absolute' => TRUE,
 )),
 ));
 }
 return $stored_feed_links;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.