diff --git a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
index 7b57afbef24eab4df4ee11a3771c39507008937a..4d5dd9abefcbe6a1b0afce9872b2883e0445fea1 100644
--- a/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
+++ b/core/modules/aggregator/lib/Drupal/aggregator/Controller/AggregatorController.php
@@ -294,10 +294,10 @@ public function categories() {
    *   The rendered list of items for the feed.
    */
   public function pageLast() {
-    drupal_add_feed('aggregator/rss', $this->config('system.site')->get('name') . ' ' . $this->t('aggregator'));
-
     $items = $this->entityManager()->getStorageController('aggregator_item')->loadAll();
-    return $this->buildPageList($items);
+    $build = $this->buildPageList($items);
+    $build['#attached']['drupal_add_feed'][] = array('aggregator/rss', $this->config('system.site')->get('name') . ' ' . $this->t('aggregator'));
+    return $build;
   }
 
   /**
diff --git a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php
index 95b29231dc77f3e3dc13b4f03ff37f333e7b3246..e801c9dcb965050e655eed8828af66601c7d0b18 100644
--- a/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php
+++ b/core/modules/forum/lib/Drupal/forum/Controller/ForumController.php
@@ -117,10 +117,6 @@ public function forumPage(TermInterface $taxonomy_term) {
     // Get forum details.
     $taxonomy_term->forums = $this->forumManager->getChildren($this->config->get('vocabulary'), $taxonomy_term->id());
     $taxonomy_term->parents = $this->forumManager->getParents($taxonomy_term->id());
-    if (empty($taxonomy_term->forum_container->value)) {
-      // Add RSS feed for forums.
-      drupal_add_feed('taxonomy/term/' . $taxonomy_term->id() . '/feed', 'RSS - ' . $taxonomy_term->label());
-    }
 
     if (empty($taxonomy_term->forum_container->value)) {
       $topics = $this->forumManager->getTopics($taxonomy_term->id());
@@ -178,6 +174,9 @@ protected function build($forums, TermInterface $term, $topics = array(), $paren
       '#forums_per_page' => $this->config->get('topics.page_limit'),
     );
     $build['#attached']['library'][] = array('forum', 'forum.index');
+    if (empty($term->forum_container->value)) {
+      $build['#attached']['drupal_add_feed'][] = array('taxonomy/term/' . $term->id() . '/feed', 'RSS - ' . $term->label());
+    }
 
     return $build;
   }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
index 3fbb36518c7520c1d4a4c1e5630fcb5e64642746..b871710c1588489422e61a3c46c0f44ce2f0b338 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/AddFeedTest.php
@@ -71,9 +71,11 @@ function testBasicFeedAddNoTitle() {
     );
 
     foreach ($urls as $description => $feed_info) {
-      drupal_add_feed($feed_info['input_url'], $feed_info['title']);
+      $build['#attached']['drupal_add_feed'][] = array($feed_info['input_url'], $feed_info['title']);
     }
 
+    drupal_render($build);
+
     $this->drupalSetContent(drupal_get_html_head());
     foreach ($urls as $description => $feed_info) {
       $this->assertPattern($this->urlToRSSLinkPattern($feed_info['output_url'], $feed_info['title']), format_string('Found correct feed header for %description', array('%description' => $description)));
diff --git a/core/modules/taxonomy/taxonomy.pages.inc b/core/modules/taxonomy/taxonomy.pages.inc
index 3cf82e288f2be0f0b9ae514ba29a637b2d489552..fb88184a5b80f0c8bcfd4f0a4cd898ebdc2e5eb8 100644
--- a/core/modules/taxonomy/taxonomy.pages.inc
+++ b/core/modules/taxonomy/taxonomy.pages.inc
@@ -19,7 +19,7 @@ function taxonomy_term_page(Term $term) {
   // Assign the term name as the page title.
   drupal_set_title($term->label());
 
-  drupal_add_feed('taxonomy/term/' . $term->id() . '/feed', 'RSS - ' . $term->label());
+  $build['#attached']['drupal_add_feed'][] = array('taxonomy/term/' . $term->id() . '/feed', 'RSS - ' . $term->label());
 
   foreach ($term->uriRelationships() as $rel) {
     $uri = $term->uri($rel);
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
index 90a5390fa223d782dfc9a30f1d8427b375ef6621..7b1e0b183b4ae0b214e8b99b72017751063b768f 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/style/Rss.php
@@ -44,7 +44,8 @@ public function attachTo($display_id, $path, $title) {
     $url = url($this->view->getUrl(NULL, $path), $url_options);
     if ($display->hasPath()) {
       if (empty($this->preview)) {
-        drupal_add_feed($url, $title);
+        $build['#attached']['drupal_add_feed'][] = array($url, $title);
+        drupal_render($build);
       }
     }
     else {