Theme installation issue

Hey guys, newbie here!

I am having an issue with installing a new theme from the admin panel. I am trying to install the X-Corporation Theme. I installed it and set on the config panel that this is my main theme. However, when I check my webpage out it looks like this:

@camirozario, Since Grav 1.7.0-rc.20, the auto-escape function for Twig has been enabled by default. This has been done as a security measure to prevent malicious code to run.

Theme X-Corporation has not updated its code to this change (last update 3 years ago) and hence all output is escaped.

There are three options to fix or workaround this:

  1. If you feel comfortable with code, you can go through all templates of X-Corporation and add filter | raw to output statements of which you are sure the data is safe. Eg. {{ content | raw }}, {{ assets.css() | raw }}, {{ assets.js() | raw }}, etc.
  2. Or you can add the following settings to system.yaml to disable auto-escaping:
    twig:
      autoescape: false
    strict_mode:
      twig_compat: true
    
    Clear the cache after adding this snippet.
  3. Choose a theme which has taken care of auto-escaping.

Note:
As said, auto-escaping is a security measure, which makes option 2. only advisable as temporary solution until all templates have been fixed as mentioned in option 1.

By the way, I’ve asked the developer if there are any plans to fix this.

Hey, thank you for your answer!

The second option worked perfectly! thank you so much!

1 Like

Hi,
I have the same problem with the Clean-Blog theme and tried the workaroud from @pamtbaau: installed the theme, modiefied the system.yaml and cleared all caches.

However I still see only parts of the source of my project. Switching back to Quark, everthing is fine.

Is the theme (clean blog) buggy or too old?

Regards
Berni

@berni51, Theme ‘Clean-Blog’ is indeed not ‘autoescape’ compatible with Grav 1.7, which can be fixed using one of the solutions mentioned above.

Besides the autoescape issue, themes are not necessarily interchangeable. E.g. the templates provided may differ, or the way a hero image is displayed may differ.

In that case, config files, templates and/or page headers need to be adapted when switching from one theme to the other.

You may want to try to download the Clean Blog skeleton and start with that. In a skeleton, the pages, theme and configurations are build for each other. They also contain required plugins.

Don’t forget to apply one of the the autoescape solutions to the skeleton!

Thanks a lot, I will try the skeleton.
Is it correct to change only the system/config/system.yaml or must all system.yaml be modified?

Regards
Berni

@berni51, Never ever change any file in the /system folder and below!

Config changes should always be made in /user/config folder and below.

Thanky you very much - you may have saved my configuration. :flushed: