سؤال

Some quick testing confirms that the front-page RSS feed in Drupal 7 does not utilize the views-view-rss.tpl.php or views-view-row-rss.tpl.php.

Can you tell me which template is used by Drual for the built-in front-page RSS feed?

I am aware of the ability to create a custom RSS feed via the Views module. I am specifically looking for information on the front page RSS feed, not custom feeds created in Views.

Thanks in advance for your time.

هل كانت مفيدة؟

المحلول

There isn't a template file for that feed; it's created by the node_feed() function which actually removes #theme from the build to make sure it doesn't go through the theme engine.

If you want to override the function altogether you can implement hook_menu_alter() in a custom module (or even a theme these days as it's an alter hook) and add a custom page callback, e.g.

function MYMODULE_menu_alter(&$items) {
  $items['rss.xml']['page callback'] = 'MYMODULE_node_rss';
}

Or you might get some mileage out of hook_node_view() if you want to alter values before they're rendered to the feed:

function MYMODULE_node_view($node, $view_mode, $langcode) {
  if ($view_mode == 'rss') {
    // Alter $node->content in some way.
  }
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top