How To Remove HTML Elements From Drupal 7 Feed

Updated: 20 April, 2017 seen 443

In this article you will learn how to style RSS feed in Drupal 7 (not sure, but most bellow written should apply to Drupal 8 as well)

I'm using RSS feeds to power up e-mail newsletters, see How To Sync Drupal RSS Feed to Mailchimp, and everything would be fine, except I had to stop automated email marketing because of amazon affiliate links included in feeds, which is against Amazon Associates TOS

If you are sending out RSS feeds via email and you are not concerned breaching some rules with links included, this article is not for you, but if you are on Drupal, using Amazon Associates for product reviews and sending out e-mail newsletters powered by RSS, keep reading.

Solution turned out much easier than I thought at start.

Visit your content type, under Manage Display scroll down to Custom Display settings and enable RSS feed

Custom Display Settings for Drupal 7 Content types

Custom Display Settings for Drupal 7 Content types

Next under RSS display settings manage fields you would like to keep, and set body to plain text (or some other predefined text format)

Rss Display settings for Drupal

Rss Display settings for Drupal

For powering Mailchimp newsletters I'm using a custom built RSS view

Add a Feed view to default content view (you can use some of your existing views, for example frontpage, or create a new content view with a feed display)

Feed settings:

  • Path: rss.xml


  • Format: RSS Feed
  • Show: Content: RSS

Now make sure you change content display settings to RSS you enabled at content type manage display section (see above). Save your view and here you go, you just stripped out all html elements from your feed. Now, if you want to keep some html elements like line breaks or paragraphs and most probably images, you should go to text format settings and enable custom html elements for plain text. 

As I'm using several RSS feeds, with just one stripping out <a href> attributes, I created a custom Text format especially for these kind of feeds - Amazon RSS Feed.

The Bottom Line

Now you now how to strip some HTML elements from Drupal Feeds, and if you are an Amazon Associate you are not breaching anymore its TOS, and don't worry your subscribers will still be able to click back to your website using title or read more links, as this method will strip out html elements from body content.


Hi! My name is Reinis Fischer (38), a proud dad and devoted husband. CEO and Founder of Terramatris crypto hedge fund, drone enthusiast, world traveler, photographer, and passionate lover of Georgian cuisine (vegetarian).

An ex-pat living in Georgia since 2011, I trade stocks, take photographs, work out at the gym, and many more. Here I write about travel, finance, and other things that might interest me.