I have a newly migrated Drupal 8 site and am noticing that the RSS feed displays the Title of a node twice in my feed reader. This is because a node's title is output both in the feed item's <title> and within the item's <description>.

For example:

  <title>My Clever Title</title>
  <description>&lt;span data-quickedit-field-id="node/123/title/und/rss"&gt;My Clever Title&lt;/span&gt;

  &lt;div data-quickedit-field-id="node/123/body/und/rss" class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;
  Lorem ipsum... my content displays here....
  ...other tags here...

So now, a feed reader like Feedly displays my content like this:

My Clever Title

My Clever Title

Lorem ipsum... my content displays here....

Note: In my RSS Manage Display, the content type is set to display the "Default" (not-trimmed) body field.

How do I prevent my RSS feed from inserting the post's title into the the <description> tag?

2 Answers 2


I haven't tried to reproduce this on my end, but I found a Drupal.org thread with advice that may be relevant:


using 'Show: content' looks like a bad idea to begin with.

I can get some nice clean output:

  • Choose 'Show: Fields' (so not 'Force using fields', just plain fields output)
  • Close the dialog without setting the required fields (just click the X in the top right corner)
  • Add some fields (title, body, a url, node id)
  • Go to Row style options (so click on the 'Settings' link behind 'Show: Fields'
  • Fill out the required fields with the fields you've added
  • Add more fields if you need them to fill out the required settings

If you build the description this way, you should easily be able to omit the title field. Good luck!

  • Thanks. I think I found a different fix within the thread you linked. I will post my solution below.
    – Tantalus
    Dec 30, 2019 at 15:44
  • 1
    This is how I do RSS in 8.
    – mpdonadio
    Dec 30, 2019 at 16:05
  • 1
    Turn's out this is the way to go. My alternate preprocess fix had other issues.
    – Tantalus
    Jan 1, 2020 at 15:20

Following the link in hotwebmatter's answer, I found the following fix based on this comment: https://www.drupal.org/project/drupal/issues/2946812#comment-13329019

function MYTHEME_preprocess_views_view_row_rss(&$variables) {
  $html = $variables['description'];

  $dom = new \DOMDocument;
  $xpath = new \DOMXpath($dom);
  $to_replace = [];
  $replace_with = [];

  // Search for post title based on data-quickedit-field-id attribute
  $found = $xpath->query('//*[contains(@data-quickedit-field-id,"/title/en/rss")]');
  if (!empty($found[0])) {
    $to_replace[] = $found[0]->ownerDocument->saveXML($found[0]);
    $replace_with[] = '';

  $html = str_replace($to_replace, $replace_with , $html);
  $variables['description'] = $html;

The title field does not have a class in my RSS output so I changed the original code to look in the quickedit attribute.

  • 1
    Well, I have been using this fix for a few days now and it isn't behaving as my original results indicated. It throws PHP errors into the log. There was a fix on the thread that addressed this, but that fix stopped this from working. hotwebmatter's solution is superior to this.
    – Tantalus
    Jan 1, 2020 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.