Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Trouble getting themes to load

theme

Solved by Karmalakas View solution

Started by Russell 5 years ago · 4 replies · 2135 views
5 years ago

I'm new to Grav, and I'm having trouble getting themes to load properly. I have it installed on my laptop and my VPS, Arch and Debian respectively, and when I change from Quark, it appears that the HTML doesn't even get rendered. This is what I see:

HTML
<link href="/user/themes/grayscale/css/bootstrap.min.css" type="text/css" rel="stylesheet"> <link href="/user/themes/grayscale/css/grayscale.css" type="text/css" rel="stylesheet"> <link href="/user/themes/grayscale/css/font-awesome/css/font-awesome.min.css" type="text/css" rel="stylesheet"> <link href="/user/plugins/markdown-notices/assets/notices.css" type="text/css" rel="stylesheet">
Grav

<h1>My Home Page or Whatever...</h1> <h2>tips, tricks, interesting, ramblings, etc.</h2> <p>This page is somewhat a project to learn Grav as a CMS and blogging solution. I like it because I can write new articles, pages, whatever in vim using markdown and that's it. No stupid database to keep up with, the admin panel is largely optional... It just seems like a pretty slick solution. I don't really have much to talk about, so this is just a collection of short how-to articles and that sort of thing. It's not really for anyone but me.</p> <h3>Find out all about Grav</h3> <ul> <li>Learn about <strong>Grav</strong> by checking out our dedicated <a href="http://learn.getgrav.org">Learn Grav</a> site.</li> <li>Download <strong>plugins</strong>, <strong>themes</strong>, as well as other Grav <strong>skeleton</strong> packages from the <a href="http://getgrav.org/downloads">Grav Downloads</a> page.</li> <li>Check out our <a href="http://getgrav.org/blog">Grav Development Blog</a> to find out the latest goings on in the Grav-verse.</li> </ul>

Copyright © Grav 2014 · by VC
<script src="/system/assets/jquery/jquery-2.x.min.js"></script> <script src="/user/themes/grayscale/js/bootstrap.min.js"></script> <script src="/user/themes/grayscale/js/jquery.easing.min.js"></script> <script src="/user/themes/grayscale/js/grayscale.js"></script> 

I've tried using the Admin panel on the Arch install and directly editing the user/config/system.yaml on the Debian install with the same results. I can switch back to Quark, and it's fine. I was even able to switch to DarkQuark and it worked, but Grayscale doesn't work on either system. I also tried Chalk on my laptop/Arch install and had the same result.

I don't have any idea what would cause this. I'm not finding anything in my system logs.

UPDATE: It actually is rendering the html. If I view the source, it's showing &gt; and &lt; everywhere. It also has the usual html tags in the source. Totally bizzare!!

last edited 04/29/21 by Russell
5 years ago Solution

You most likely have old theme designed for Grav 1.6 (or older), which presumes content is not escaped. In your theme wherever the templates content with HTML tags is outputted, you should add |raw filter. Eg. {{ template_output|raw }}

👍 1
5 years ago

Did a quick run on all themes. It seems that 77/112 themes do not use filter |raw on *content, *css() or *js()

I created an issue to start a discussion with the team to notify developers and users for this.

👍 2
last edited 04/29/21 by pamtbaau
5 years ago

I've been going through the theme file by file searching for }} and adding |raw where applicable. I finally got it to load though there are still some errors. Changing the line {{ assets.css() }} to {{ assets.css()|raw }} is what finally got the stylesheets to load.

Thanks for the help. I wonder if I should clone the theme from github and submit my fixes? I don't know much about grav yet, but I seem to be making progress on getting this theme to work.

5 years ago

@rustbuckett:
I wonder if I should clone the theme from github and submit my fixes?

If theme is still supported, then why not 🙂

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 226 2 months ago
Themes & Styling · by Ian, 2 months ago
3 118 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 483 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 73 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 152 3 months ago