0

I am trying to build a calendar rss feed from views. The rss.xml is being generated, but it doesn't appear to be accepted as a calendar rss on local systems.

When I look at the source, I see it's shot through with theme debugging comments.

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_rss' -->
<!-- BEGIN OUTPUT from 'core/modules/views/templates/views-view-rss.html.twig' -->
<?xml version="1.0" encoding="utf-8" ?>
...

Worryingly, I'm also getting escaped angle brackets in some places:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view_row_rss' -->
<!-- BEGIN OUTPUT from 'core/modules/views/templates/views-view-row-rss.html.twig' -->
<item>
...
&lt;!-- THEME DEBUG --&gt;
&lt;!-- THEME HOOK: &#039;ds_entity_view&#039; --&gt;
&lt;!-- BEGIN OUTPUT from &#039;modules/contrib/ds/templates/ds-entity-view.html.twig&#039; --&gt;
...

I'm not an expert on the theming system. I googled for how to turn off theme debugging, but I used drush to issue this command:

$ drush state-set theme.debug 0
$ drush @local sget theme.debug
0
$ drush @local cr
Cache rebuild complete.  

However I am still getting the theme debugging comments in my rss.xml.

How do I disable theme debugging?

Edit I looked at my /sites/default/services.yml

39   twig.config:
40     # Twig debugging:
41     #
42     # When debugging is enabled:
43     # - The markup of each Twig template is surrounded by HTML comments that
44     #   contain theming information, such as template file name suggestions.
45     # - Note that this debugging markup will cause automated tests that directly
46     #   check rendered HTML to fail. When running automated tests, 'debug'
47     #   should be set to FALSE.
48     # - The dump() function can be used in Twig templates to output information
49     #   about template variables.
50     # - Twig templates are automatically recompiled whenever the source code
51     #   changes (see auto_reload below).
52     #
53     # For more information about debugging Twig templates, see
54     # https://www.drupal.org/node/1906392.
55     #
56     # Not recommended in production environments
57     # @default false
58     debug: false

This doesn't seem to be the issue, unless I misunderstood or misread.

Edit 2 Following the advice in the comments, I've made the following edits in my configuration:

  • set cache: false in sites/default/services.yml
  • set debug: false in sites/development.services.yml
  • commented out the line loading /services.yml in /sites/default/settings.php

Here are the changes:

 $ git diff

diff --git a/sites/default/services.yml b/sites/default/services.yml
index c6c9e71b9..be755d7a1 100644
--- a/sites/default/services.yml
+++ b/sites/default/services.yml
@@ -75,7 +75,7 @@ parameters:
     #
     # Not recommended in production environments
     # @default true
-    cache: true
+    cache: false
   renderer.config:
     # Renderer required cache contexts:
     #
diff --git a/sites/default/settings.php b/sites/default/settings.php
index 04b8a66e2..a61098d01 100644
--- a/sites/default/settings.php
+++ b/sites/default/settings.php
@@ -3,7 +3,7 @@
 /**
  * Load services definition file.
  */
-$settings['container_yamls'][] = __DIR__ . '/services.yml';
+# $settings['container_yamls'][] = __DIR__ . '/services.yml';

 /**
  * Include the Pantheon-specific settings file.
diff --git a/sites/development.services.yml b/sites/development.services.yml
index 0553016c1..bdf4461b9 100644
--- a/sites/development.services.yml
+++ b/sites/development.services.yml
@@ -5,7 +5,7 @@
 parameters:
   http.response.debug_cacheability_headers: true
   twig.config:
-    debug: true
+    debug: false
     auto_reload: true
     cache: false
 services:

And of course, I've done a cache rebuild. I also decided to do a fresh backport, just in case. But, I'm still getting the debugging comments. Here's a partial screenshot of the views preview:

enter image description here

Edit It turns out, I didn't have development.services.yml in my settings.php (I had commented out a line loading a different yaml file).

$ grep development.services.yml settings.php

$
  • I'm voting to close this question as off-topic because it's all documented in the docs @see drupal.org/docs/8/theming/twig/debugging-twig-templates – leymannx Jan 17 '19 at 19:02
  • 1
    And sites/development.services.yml? – leymannx Jan 17 '19 at 19:09
  • 3
    There are probably a bunch of places you could force that, but development.services.yml is the most common if it's not happening in services.yml – Clive Jan 17 '19 at 19:32
  • 2
    Just to rule it out, open the dev tools in your browser, go to the network tab, disable the cache, and try again. Browsers tend to be very aggressive with caching these days, and you might be seeing stale data – Clive Jan 17 '19 at 20:13
  • 2
    Indeed, that's line 76 of core/themes/engines/twig/twig.engine – Clive Jan 17 '19 at 20:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.