Hi, I have tried outputting rss feeds straight as RSS feed, RSS default and force as fields.
Still the feeds publish with ‘submitted by’ and ‘publishing date’ shown inside the description tag, don’t want that :)
Have made sure that each content type has ‘authored by’ deselected, still no joy.
Is it hardcoded somewhere? Would most appreciate any suggestions on how to remove the unneccesary text that appears in my feeds.
The description is build inside \Drupal\node\Plugin\views\row\Rss::render
This seems ok, but somehow this doesn't account for some of the settings on the node type:
$build_mode = $display_mode;
$build = node_view($node, $build_mode);
unset($build['#theme']);
Workaround is using fields instead of content, steps can be found in #17
Comments
Comment #2
damienmckennaViews was moved into core in D8, so I'm moving the issue over to its issue queue.
Comment #3
liliplanet commentedI’m still trying to remove date and authored by on rss feeds coming from views.
My feed is a simple Format: RSS Feed and Show Content: Use default RSS settings
As mentioned, ‘authored by’ is switched off in content type.
I tried removing
{{ channel elements }}from views-view-rss.html.twig, makes no difference.‘Authored by and date’ is coming from somewhere else in views, please have a look at your rss feed, please how can I fix this?
Most appreciate any support :)
Comment #4
liliplanet commentedOn a mission here .. removed the following from node.html.twig, still no joy (:
If it’s not in the core views or node templates, where else can I look please?
Comment #5
liliplanet commentedComment #6
lendude@Liliplanet Yes this appears to get added in
\Drupal\node\Plugin\views\row\Rss::renderMight be needed to get valid feed XML, although it looks like they are optional.....
Comment #7
liliplanet commentedThank you so much for your response @Lendude! The module viewsrss not ready for D8, what do mean ‘get a valid feed xml?
Are you saying it is not possible currently to get a clean feed without
What is the solution please, most appreciate your time 🌸
Comment #8
lendudeWell a RSS feed needs to contain certain elements to adhere to the RSS specs, like described here http://www.rss-specifications.com/rss-specifications.htm
It may be that the elements you want to take out are required in some version of those specs. They aren't required in the 2.0 specs, but they may be in an older version, I don't know.
I think the easiest way to get the result you want is to override views-view-row-rss.html.twig in your theme and add an
ifinsideforloop to testitem.key!= pubDate oritem.key!= dc:creatorDoes that work for you?
Moving this back to a support request because I don't think we want to change the default behaviour here.
Comment #9
liliplanet commentedThank you so much for your help Lendude! I replaced the code with the following:
Still no change. I even tried ..
in core, not even duplicated the template to my themes/bootstrap/templates/views
cache cleared, authored by and date still shows up on feeds 😅
Lendude, outputting rss feeds this way is not usable, I would consider it a bug 🤗
Comment #10
liliplanet commentedThe great news is that
Drupal\node\Plugin\views\row\Rss::renderis not the culprit, when I removed pubdate and creator (which is indeed necessary to validate the feed), submitted by and date still shows up.Comment #11
liliplanet commentedSorry, but really trying to figure this out ..
I went as far to copy code
views-view-row-rss.html.twigfrom rss views D7Author and publising date is still in the feed 😔
It does not seem to be coming from the templates, not from
Drupal\node\Plugin\views\row\Rss::renderthen where? :)
Comment #12
lendude@Liliplanet well it is coming from the templates but I'm guessing not the ones you are modifying. Using a D7 template should totally break everything, so if stuff still gets printed when you do that, that means you are not working on the right template.
You need to copy the provided template to the theme you are using, then the one in the theme will be used.
Oh and lots of cache clearing when you change stuff for it to be picked up.
Comment #13
liliplanet commentedThank you for your patience Lendude, so much appreciated 🌸
In the code you posted earlier, please can we try again?
What is the ADD AN IF here? Sorry, way over my head 🤓
Comment #14
liliplanet commentedComment #15
liliplanet commentedComment #16
liliplanet commentedComment #17
lendude@Liliplanet ahhh! Wait a minute, are you talking about the create date and author name INSIDE the description tag? Sorry totally missed that you might be referring to those!
I can reproduce that locally, and looked around a bit more in
\Drupal\node\Plugin\views\row\Rss::renderand this is done by:
But no idea why the RSS display mode would show those at the moment.
But looking at your description output (and mine locally), even if you take the author and submitted date out, that output is still crap. It contains wrappers for quick edit and all sorts of other escaped HTML tags. So using 'Show: content', looks like a bad idea to begin with.
I can get some nice clean output:
- Chose '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 will out the required settings
So setting it up like this:

So that ends up looking like this:
But the fact that the default output is Content, and it outputs totally useless escaped HTML filled junk, is something that needs to be addressed.
Comment #18
liliplanet commentedWow, that sounds awesome, will revert back as soon as I can run a test, thank you so much!
Comment #19
liliplanet commentedLenDude, you are my absolute hero! Thank you so much for finding the solution here ✨
Just a note, relative path needs to rewritten in the field, output somehow cuts off the first part.
Image size for social networks is 1200x630px
RSS feed date is ‘r’ and it looks so beautiful.
LenDude, arms full of virtual flowers for you 🌸🌷🌸🌷🌸🌷🌸🌷🌸🌷🌸🌷
Comment #20
liliplanet commentedComment #21
lendude@Liliplanet glad it works now!
Lets leave this as a bug. The fact that RSS displays default to showing content and then display lots of HTML garbage isn't right. But with a valid workaround it's not high on my fix list :)
Comment #22
seirerman commentedSame problem here on Drupal 8.5.5, but you can get rid of the unwanted HTML tags:
Edit the field for the description in the view, then check "Strip HTML tags" under "Rewrite results". Save the view after that.
Comment #25
diamondseaThis issue doesn't seem to have anything to do with the twig templates, it seems it is being added somewhere in the rendering of the node in the Content format, where it renders the node and assigns it to $item->description in /core/modules/node/src/Plugin/views/row/Rss.php.
Line 129 renders the node:
and Line 148 assigns it to the $item->description which gets rendered as the . tag in the XML output:
I haven't been able to find out where yet, though (stepping through render functions is tedious at best).
Comment #26
mhdev90 commentedYou can use the "entity_view_display_alter" hook.
e.g.:
Comment #27
laura.gates@Lendude your workaround posted in #17 doesn't seem to work anymore in 8.7.4. When I follow your example and use fields, I get validation errors when ingesting the feed into a third-party-application.
Comment #29
fjgarlin commentedI was facing the same issue here.
I ended up creating a template hook: "template_preprocess_views_view_row_rss" to strip those undesired elements as due to the project set up I couldn't change the view to show fields instead of RSS teaser mode.
I used this technique to get rid of the tags: https://stackoverflow.com/questions/15627523/delete-html-elements-with-p...
Comment #30
cuman commentedHi
I tried it and get:
Warning: DOMDocument::loadHTML(): Tag section invalid in Entity, line: 22 в mytheme_preprocess_views_view_row_rss() (строка 13 из /home/u13436/domains/mydomen/web/themes/custom/mytheme/mytheme.theme) #0 /home/u13436/domains/mydomen/web/core/includes/bootstrap.inc(587): _drupal_error_handler_real(2, 'DOMDocument::lo...', '/home/u13436/do...', 13, Array) #1 [internal function]: _drupal_error_handler(2, 'DOMDocument::lo...', '/home/u13436/do...', 13, Array) #2 /home/u13436/domains/mydomen/web/themes/custom/mytheme/mytheme.theme(13): DOMDocument->loadHTML('<span property=...') #3 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): mytheme_preprocess_views_view_row_rss(Array, 'views_view_row_...', Array) #4 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('views_view_row_...', Array) #5 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(450): Drupal\Core\Render\Renderer->doRender(Array) #6 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) #7 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Template/TwigExtension.php(501): Drupal\Core\Render\Renderer->render(Array) #8 /home/u13436/domains/mydomen/web/sites/default/files/php/twig/5dc2e6cdd1459_views-view-rss.html.twig_UUnUjJ9j_KcYvCDefjA8wlfA_/c8WB115fheBBwNwBUPF-VqrqSRq-EZiQzEVSc4MepvI.php(85): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true) #9 /home/u13436/domains/mydomen/vendor/twig/twig/src/Template.php(455): __TwigTemplate_b41ef8aa305cef138fa389ffb238aa4b4b8378a4e17cc1354c1d9e0372cadd40->doDisplay(Array, Array) #10 /home/u13436/domains/mydomen/vendor/twig/twig/src/Template.php(422): Twig\Template->displayWithErrorHandling(Array, Array) #11 /home/u13436/domains/mydomen/vendor/twig/twig/src/Template.php(434): Twig\Template->display(Array) #12 /home/u13436/domains/mydomen/web/core/themes/engines/twig/twig.engine(64): Twig\Template->render(Array) #13 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('core/modules/vi...', Array) #14 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('views_view_rss', Array) #15 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(450): Drupal\Core\Render\Renderer->doRender(Array) #16 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true) #17 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(139): Drupal\Core\Render\Renderer->render(Array, true) #18 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() #19 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(140): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #20 /home/u13436/domains/mydomen/web/core/modules/views/src/Plugin/views/display/Feed.php(63): Drupal\Core\Render\Renderer->renderRoot(Array) #21 /home/u13436/domains/mydomen/web/core/modules/views/src/Routing/ViewPageController.php(52): Drupal\views\Plugin\views\display\Feed::buildResponse('rss', 'feed_2', Array) #22 [internal function]: Drupal\views\Routing\ViewPageController->handle('rss', 'feed_2', Object(Drupal\Core\Routing\RouteMatch)) #23 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #24 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #25 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #26 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #27 /home/u13436/domains/mydomen/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #28 /home/u13436/domains/mydomen/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #29 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /home/u13436/domains/mydomen/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(191): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /home/u13436/domains/mydomen/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(128): Drupal\page_cache\StackMiddleware\PageCache->fetch(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /home/u13436/domains/mydomen/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(82): Drupal\page_cache\StackMiddleware\PageCache->lookup(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #36 /home/u13436/domains/mydomen/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #37 /home/u13436/domains/mydomen/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /home/u13436/domains/mydomen/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #39 {main}.What's wrong?
Comment #31
fjgarlin commentedNothing seems wrong, you might just need to turn warnings off for that call as suggested here: https://stackoverflow.com/questions/6090667/php-domdocument-errors-warni...
Comment #32
cuman commentedThank you for errors-cleaning
But I still get ‘submitted by’ and ‘authored on date’ inside the description tag
Comment #33
fjgarlin commented@cuman, that's because your markup doesn't contain the classes that the code was looking for. You can change the xpath selector to target:
rel="schema:author"instead. Likewise for the date.Comment #34
cuman commented@fjgarlin, i did so:
But no changes
Comment #35
cuman commentedFinaly I solved by views_rss and this patch: https://www.drupal.org/project/views_rss/issues/3070596
Comment #36
laura.gates@cuman
Thanks for this! However, IMO, a patch to core is still the preferred solution as views_rss is still considered an experimental module and the current dev branch has been broken for a while and relies on some old patches to hold things together. I'm concerned about possible security issues with views_rss.
Comment #37
rodricels commentedThis issue will be fixed by #2353867: [META] Expose Title and other base fields in Manage Display and #1399990: Remove "Display author and date information" in Display Settings in favor of listing Author and Date in Manage Displays
A workaround is possible for 8.7 and 8.8 with https://www.drupal.org/project/manage_display.
Another workaround if you're using View display content instead of fields, is create twig's files for these node-fields, they're based on core/themes/stable/templates/field/field.html.twig
You can remove all displayed content for RSS, with:
Comment #38
eiriksmHere is another workaround:
In your theme or module (example is from theme):
Comment #40
mrshowermanThanks @eiriksm, this worked for me. However, I had to remove the overriding of the #theme key, because it led to a fatal error in the node theme suggestion processing. I also changed the last line, so altogether it now looks like this:
Comment #41
jabastin arul commented@mrshowerman
Still Its not working.
Comment #44
robertom commentedSame problem here.
Attached a proposed patch that permit to use the node template override, so we can use a template like node--rss.html.twig
Comment #49
joshua1234511Workaround can be done via theme
Comment #51
tichris59 commentedWorkaround #49 works like a charm but the following part is not useful, $uuid is not used after this:
Comment #52
acbramley commentedThere seems to be quite a few options for fixing this in custom code including a somewhat simple preprocess hook. Do we need to do anything else here?
Comment #53
smustgrave commentedWanted to bump 1 more time before closing.
Comment #55
noah commentedI'm willing to take a shot at putting together a patch for this when I can.
There are options for working around it currently but most of them require parsing core's hardcoded output with
DOMDocument(), which is not ideal (and not very Drupally). Givingtemplate_preprocess_views_view_row_rss()access to the various components of the feed item without having to parse HTML would be a step in the right direction—I'll see where I can get with that.Comment #56
noah commentedApologies for having been so slow to follow up on this, but I have some answers now. I'm convinced this is a real bug (for reasons explained here), but also that the current path forward is a contrib module.
First, why this happens: in the context of feeds, nodes are rendered by \Drupal\node\Plugin\views\row\Rss::render() which, around line 125, does:
Once '#theme' is gone, no preprocessing is done on the node, including the core node module's own preprocessing at \Drupal\node\Hook\NodeThemeHooks::preprocessNode(). The core preprocessing includes some code that extracts and then unsets the relevant elements, preceded by this comment:
So because nodes displayed in feeds have no '#theme' element they're never preprocessed, and because they're never preprocessed the title, uid, and created elements are never extracted to be addressed separately in a template file; as a result the elements are still present when the description is built and they show up there.
A good fix for this in core is going to depend on https://www.drupal.org/project/drupal/issues/3015623 being sorted out, which does not appear to be likely to happen anytime soon. So I'm working on a module that I'll link to here when (if) it's available.