We have two good reasons to remove {{ feed_icons }}:
One: because it stands in the way of better page rendering
As part of #2350943: [Meta] Untangle Drupal 8 page rendering, we concluded that we want to try to complete the conversion away from "random variables" for the page template (page.html.twig) towards using only regions.
One of the things encountered in the page template is the feed_icons variable. This used to rely on drupal_render() storing encountered attached feeds in a global static variable. And in fact it still does. But we're moving away from that — that's been a long-term goal of WSCCI/SCOTCH, and we're mostly there. This is one of the last blockers.
The reason it currently works is that the *contents* of the page are first rendered into a HtmlPage object, which also calls drupal_process_attached() and hence calls _drupal_add_feed(). This, in turn, ensures that a call to drupal_get_feeds() works as expected. Hence template_preprocess_page() can call drupal_get_feeds() and get meaningful results. But, we're removing HtmlPage and as part of that, the parts within the page are only going to be rendered after template_preprocess_page() has run, and hence the #attached feeds for the child render arrays won't have been processed yet.
The solution is super simple: make ['#attached']['feed'] simply an alias of ['#attached']['html_head_link'], which automatically sets the rel=alternate and type=application/rss+xml attributes.
Two: because it's antiquated, inflexible, imposing, ugly and mostly useless
Finally, I'm fairly certain that it's a pointless feature anyway in 2014 and beyond:
- I'm willing to bet themers hate this special snowflake
{{ feed_icons }}in their Twig templates - It looks ugly and off.
- If you really want icons for your feeds, you're probably going to use the "Syndicate" block, or custom blocks, so that you can control where the feed icons appear, rather than them being hardcoded.
- Very, very, very few people ever use it, since browsers make it easy to know there's a feed to subscribe to on the current page, since there's of course still the
<link>tag.
Comments
Comment #1
wim leersNote that we keep
theme_feed_iconandfeed-icon.html.twigaround, because e.g. the "Syndicate" block uses it, as does the aggregator module, as does Views.Comment #2
wim leersNote that we keep
theme_feed_iconandfeed-icon.html.twigaround, because e.g. the "Syndicate" block uses it, as does the aggregator module, as does Views.Comment #3
catchAlso if someone really wanted the automatic feature, it could be done using js - that way you have access to the final
<head>output.Comment #5
wim leersA single test fail, due to a single test wrongly relying on the feed icon being present rather than a
<link href="FEED URL" />tag being present.Comment #6
dawehnerI am sorry but this statement is 100% wrong. Have a look at the following URL with your browser: https://www.drupal.org/node
Neither chrome nor firefox helps you to figure out that there is a feed. Yes, it used to be like that, but this is no longer the case. Showing people that you have an RSS feed available is a thing for blogs.
Comment #7
dawehnerAnd note: views has probably just no test coverage but renders out the icon by default on /node
Comment #8
catch@dawehner this wouldn't get rid of the Views rendering (or at least it shouldn't).
Comment #9
wim leersThat's a fair point, but nowadays people use bookmarklets, browser extensions or write/copy'npaste the website URL (e.g.
http://wimleers.com) and then the feed reader figures out which feeds are available. So it's really not a big problem. I don't know a single prominent site anymore that shows feed icons, but almost all of them provide a feed in a<link>tag.All other points still stand, and further reduce the problematicness of your (valid!) point: the "Syndicate" block still exists, and Views has the ability to show a feed icon as well.
The point is that this doesn't belong in the page template, where you don't have good control over it.
Comment #10
lauriiiComment #11
rteijeiro commentedI agree that there is no need of having a RSS attached to every single Drupal page. It's a better solution to provide it if you really need it using the Syndicate block.
Patch looks pretty and also provided screenshots:
BEFORE
AFTER
Comment #12
dawehnerLooking at #2357937-11: Remove {{ feed_icons }} from page template (page.html.twig) views seem to have lost the capability to render it, didn't it :)
Comment #13
lars toomre commentedDoes it make sense then to add the js code to add access to the final head output? That would satisfy both @wim and @dawehner's concerns.
Comment #14
wim leers#12: No, that's the removed
{{ feed_icons }}inpage.html.twigthat you're seeing (well, not seeing anymore, of course). There still is{{ feed_icon }}inviews-view.html.twig! :)#13: No, that'd be even worse, since that'd mean we'd be loading JS for something that is used only extremely rarely, and it'd mean loading JS for anonymous users again. I appreciate the suggestion though! :)
Comment #15
Jeff Burnz commentedYep, good call, lets get rid of it. +1 for the reasons stated in the OP.
Comment #16
lewisnyman+1, if people do use RSS then they don't use it like this.
Comment #17
catchDoes this mean the front page view needs configuring the show the RSS icon though?
Comment #18
lewisnymanThey don't because they removed support for it. If you care enough then you can download an RSS plugin. Here it is in action:

Comment #19
wim leersIMHO it doesn't. It's antiquated to show it at all, as I mentioned in #9 — do you know of any prominent sites still showing the RSS feed icon? As LewisNyman showed in #18, people using feeds can easily make
Comment #20
dawehnerWell yeah I think power users would use some browser plugin anyway.
For blogs using the syndicate block is probably a good idea.
@Wim Leers
We need to update the
Rss.phpComment #21
wim leersWhy? Nothing in this patch affects that code? So are you saying we should make it more consistent? Or fix a bug? Or…?
Comment #22
dawehnerJust to be sure, I try to be nice again ;)
The current code looks like the following:
So for page displays we use drupal_add_feed() which allows us to get rid of adding doing a lot of stuff. For blocks we can't that easy render the feed icon, so
we have to drop more code, as well as get rid of $view->feed_icon, I guess ...
Just to be clear, we would have to expand the capabilities of the syndicate block to make it actually useful.
Comment #23
joelpittetJust from "prominent sites" argument using the icon, when I'm testing the RSS aggregator I always go to news sites:

BBC
NBC

CBC

I do agree with removing it so big +1 to this issue in general. And RSS is getting used much less than it was(Damn you twitter!)
Just want to echo @dawehner's concerns and hope we don't rush to hastily to remove a feature without providing a DX friendly alternative.
What's the plan to make it fairly easy to add tags/elements to head from blocks, views, wherever? #attached is covering js/css well enough at the moment. Specifically it looks like _drupal_add_html_head_link is a deprecated function, so were is that headed?
Feed icon should be fine removed as long as we can get the feed_url to the template a themer can wrap it around their SVG, png, icon font, or whatever. Which should be really easy on a Views template id' expect. Getting rid of view->feed_icon should be fine to do as long as feed_url is discoverable.
Comment #24
joelpittetTo answer my own question, as I wasn't aware...
Change record (updated because there was a typo for feed):
https://www.drupal.org/node/2160069
Couple of questions on the current patch:
Why a static here and is it still needed in drupal_process_attached now that the code has moved there?
Doesn't this make it difficult to change the type if it's an opml feed or something?
Comment #25
rainbowarrayRemoving this special snowflake variable has been in my head for months now. Thanks for taking care of this Wim.
I used to use RSS all the time. I can't remember the last time I used it. As I grow more disenchanted with Twitter, I think about returning to RSS. But core should be solving the 80% use cases, and I'm not sure having a RSS link visible on the page falls into that 80% use case anymore.
+1 to saying goodbye to the feeds variable.
Comment #26
andypost+1 to remove in favour of block
IMO most of sites needs separate block with own links so RSS is mostly an icon within others in "social" block and I would like to see follow-up to transform "syndicate" block into a kind of "follow" block.
@dawehner +1 to
Only page views should be able to expose head link.
Comment #27
dawehner@Wim Leers
Sure, we can remove it, but we should be aware of the fact that the syndicate block is that helpful for the day to day use.
It simply points to '/rss.xml' which is one URL controlled by views. People might easily build other rss feeds, so we maybe should expand that block a bit.
Comment #28
andypost#27 suppose it's not good idea to allow a block to get page state...
Comment #29
wim leersRE: BBC/CBC/NBC: fair :) So that aspect was then biased by the sites *I* visit on the internet, which don't have it anymore. Though these indeed show that there is usually only a single feed link, and it's usually styled in a customized way. Perfect fit for the "Syndicate" block, or quite possibly for a custom "Follow us" block, with RSS + social media links, which seems to be the new pattern.
This is already covered:
['#attached']['html_head_link']for<link>tags in<head>,['#attached']['html_head']for *any* tag in<head>. Works for blocks, views, wherever… even preprocess functions :)I'll repeat what I said in #14:
i.e. this is not changing Views in any way.
#24.1: I don't understand the question.
#24.2: It's always been like this. This is not an API change.
#25: I still use RSS :) But most of the time, no icons are available, in my experience. It doesn't really matter, because either the browser or a bookmarklet will discover the RSS feed for me.
#26: Agreed that having a "Follow" block would be a nice-to-have. The thing is: social services keep evolving, and come and go. So creating a block that includes a certain set of social media services will quickly be outdated. The included/associated icons will be even more quickly outdated. Therefore, this is not something core can and should do. Hence just sticking with the "Syndicate" block for now seems to be the best course of action.
#27/#28: It's true that the "Syndicate" block hardcodes a certain URL. But it's a 90% use case. Most sites who have more feeds will also want to link to social media, and then my answer to #26 is relevant again. Hence I'd once again that just sticking with the "Syndicate" block for now seems to be the best course of action.
Comment #30
wim leersDiscusssed with dawehner, this is what he wanted to see still happen in Views.
Comment #31
andypostI think core's standard profile could ship placed syndicate block into main content region to emulate BC for taxonomy pages at least. And only one nitpick:
$feed_icon is useless variable now
Comment #32
wim leersFixed #31 nitpick.
I don't think this is necessary. If others think this should happen, I'll reroll the patch to do this. It'd be configured to only be visible on
taxonomy/term/*pages.Comment #33
wim leersCorrection for my previous comment: we should not place the
Syndicateblock for taxonomy term pages, because that would link to/rss.xml, not to the taxonomy term feeds. The interdiff in #30 should in theory bring back the feed icon to all page views, just with the feed icon in the view's template rather than the page template. In practice, however, it doesn't work.It already is broken in HEAD, so fixing that is out of scope here. #2359161: Feed icons missing in views blocks and pages fixes it.
Comment #34
rainbowarrayReviewed this, looks good to me. dawehner's concerns appear to have been addressed, so I think this is all set.
Comment #35
joelpittetRegarding the syndicate/follow block, I'm sure contrib could take care of that or if we need them they could be in a followup. I'm good with the RTBC, this is a nice cruft remover:)
Re:
I was just curious what that static cache was speeding up and if that "speed" was needed somewhere else in the patch.
I'm guessing it is no longer needed as we aren't
_drupal_add_feeds'ing just adding another link to the head.and #24.2 I see what you're doing now, keeping the API in tact is all... if someone were to want to do opml or something they can just build a ['#attached']['html_head_link'][]
Comment #36
webchickNot marking down from RTBC, but aren't the screenshots in #23 advocating for *keeping* the feed icons on the page (either through Views or through a More Betterer Syndicate block)? No offense, but I'm not sure a bunch of Drupal core developers are a very representative sample of website users as a whole. ;) The fact that BBC et al keep one or more feed icons around rather than use that precious real estate as ad space seems to imply it's widely used by the internet at large (though as a counter-point I wasn't able to find such an icon on CNN.com, which AFAIK is the largest news website).
Anyway, rather than get into that whole debate, moving the RSS feed rendering to Views seems to address both issues in the OP (it doesn't futz with page rendering, and you can get rid of it if you want). So why are we trying to do this first, versus postponing on #2359161: Feed icons missing in views blocks and pages?
Comment #37
wim leers#35: that static cache wasn't there for performance reasons, it was there for "remembering the feeds added on this page". It's one of those pesky globals that we've been trying to remove.
#36: We're trying to do this in parallel with #2359161: Feed icons missing in views blocks and pages. This blocks #2352155: Remove HtmlFragment/HtmlPage, which is critical. Turns out Views has had the capability to show feed icons all along, but it's been broken for some time. #2359161 also feels like it's getting stuck rather than moving forward.
Finally: BBC et al have highly customized, highly integrated "Follow us" blocks. As I explained at the bottom of #29 (the part that replies to #26): Drupal core by definition cannot provide such an awesome "Follow us" block (for similar reasons as why we can't have Responsive Preview in Drupal core with a hardcoded set of devices). Not just a crappy listing at the bottom of the page of feed icons literally sitting next to each other (with no margins between them), without any indication what each icon is for (unless you hover… which you can't on a touch device). This patch removes a "feature" that is 10 years old, has a crappy UX, has a crappy DX, and has a crappy TX.
I do promise I'll keep #2359161: Feed icons missing in views blocks and pages moving forward.
Comment #38
catchGiven this blocks #2352155: Remove HtmlFragment/HtmlPage, bumping to critical.
Leaving RTBC a bit longer in case there's more to discuss, but personally I agree fixing the Views regression from 7.x is a separate issue to sorting out the chicken and egg page variable.
Comment #39
alexpottThis issue needs a change record because it
I guess the change record should be linked to the views issue to and once that is fixed contain instructions on how to build a replacement.
Comment #40
wim leersYou're right, this changes the
page.html.twigtemplate and hence needs a CR.Done: https://www.drupal.org/node/2362865
Comment #42
catchThanks for the change notice.
Committed/pushed to 8.0.x, thanks!
If we want to bump #2359161: Feed icons missing in views blocks and pages to critical we should, I think it's major so it depends how much the missing feature is considered a regression (and whether that regression is worth holding the release up for).
Comment #43
damiankloip commentedafaik, that issue will not fix the now missing icons for pages? So it's not about fixing an existing regression, but creating a new one as well.
So this is knowingly creating bugs to help solve other bugs? :)
Comment #44
wim leers#43: This patch made
Pageview displays with attached feeds also set feed icons, not justBlockview displays, so that you effectively still have the same behavior. Only, that doesn't work because #2359161: Feed icons missing in views blocks and pages. So, no, the "now missing icons for pages" will come back once #2359161: Feed icons missing in views blocks and pages is fixed :)Comment #45
damiankloip commentedOk, then I missed something here. Thanks!
Comment #46
andypostpublished CR