Custom number of items in your Drupal website RSS feed

Joris Snoek | 03/03/2010 - 11:39

Last week a customer asked us:

"How can I get 40 items in my RSS feed. On '/admin/content/rss-publishing' I can only choose 30 for maximum".

After a quick search I couldn't find a module that provided this.

So Lucius created a very small module that scratched his itch. Off course there are other ways, like creating a custom module to fill this number in a 'free' textfield and no dropdown box. But this did the trick for him.

This module consisted of a few lines of code that adds extra options in the form.

The allmighty code

  1. /*
  2. * Implementation of hook_form_alter
  3. */
  4. function YOURMODULE_form_alter(&$form, $form_state, $form_id){
  5.  
  6. if($form_id == 'system_rss_feeds_settings'){
  7. // Added '40' in the array
  8. $form['feed_default_items']['#options'] = drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
  9. }
  10. }

Copy and paste the lines in your code-editor, as it is too long for our content-space :-)

Feedback, Questions about RSS publishing?
Please hit me on Twitter for all your feedback, and any other issue!

Over Joris Snoek

Joris Snoek is Full time Drupal verslaafd, Project leider bij Lucius & Technology-freak. Tevens afgestudeerd in bedrijfskundige informatica en houdt veel van: muziek productie, snowboarden, tennis & fitness. En: heeft een zwak voor Duitse herders.

Over Peter Terpstra

Peter Terpstra is accountmanager bij Lucius.

Relatiebeheer en trajectbegeleiding van begin tot eind vallen onder zijn hoede.

Laatste tweet van Joris

joris_lucius: Looking into #mongodb #drupal implementation. Looks promising so far. #performance http://drupal.org/project/mongodb

Volg alle tweets van Joris

Zoeken