Skip to content
● Critical PHP security fixes are out: update PHP on your Grav sites. What to do →

"directorylisting" want render correctly

Solved by Vadym View solution

Started by Hans Breitenfellner 2 years ago · 3 replies · 488 views
2 years ago

Hi,
i´m new to GRAV and use Learn2 as Theme.
I want to show my files in a listform, so i tried "https://github.com/olevik/grav-plugin-directorylisting"
But i get only a unformatted html-output.
After analyzing i found out that the problem is, that the output contains:
< > " etc.

<div id="Files">&lt;div class=&quot;directorylist&quot;&gt;&lt;ul class=&quot;metismenu metisFolder&quot;&gt;&lt;li class=&quot;directory active&quot;

If i replace them with '>', '<', etc. then the rendering is correct and i get a correct graphical output.
<div id="Files"><div class="directorylist"><ul class="metismenu metisFolder"><li class="directory active">
Correct:
image|260x101

Any ideas what´s wrong? Any settings to change?

2 years ago Solution

Hi, @habreli and welcome,
use raw twig filter, in your case it would be
{{ directorylisting|raw }}

2 years ago

@b.da:
{{ directorylisting|raw }}

Thanks,
you are my hero. I spent many hours, but i could not find this.

👍 1
2 years ago

Thanks to a tip on the repository about this thread, I updated the README to include the raw-filter in the examples. Hopefully that makes it a bit more clearer, and hopefully Grav will someday return to a situation where that sanitization isn't necessary.

👍 2

Suggested topics

Topic Participants Replies Views Activity
Plugins · by DrPen, 2 days ago
1 65 3 hours ago
Plugins · by renedebaaij, 1 week ago
1 134 3 days ago
Plugins · by Thomas, 6 days ago
1 143 5 days ago
Plugins · by complanar, 4 weeks ago
6 470 3 weeks ago
Plugins · by BenLaKnet, 3 weeks ago
1 294 3 weeks ago