List of files-names with thumbnails (theme : quark)

Hello,
I have a few files (odt and pdf, and images) in the page-folder of a ‘subsection.md’ file (theme quark).
My file ‘subsection.html.twig’ is :

{% embed ‘sections.html.twig’ %}
{% endembed %}

So I put this code in the file ‘sections.html.twig’ :

<ul>
{% for file in page.media.data %}
<li>
    <div class="file-surround">
        {{ file.link().html|raw }}{{ file.meta.title }}
    </div>
</li>
{% endfor %}
</ul>

But it doesn’t work… Can someone give me a little help ?
Thank you !

I’m not at my Grav PC now, so not sure if html() produces the icon, but I believe you should call instead of file.link().html|raw call simply file.html()|raw. Also I myself use page.media.files - don’t know what page.media.data returns actually. Also, you should define icons in media.yaml for missing file types (I believe odt is one of them)

Thank you, with “page.media.files” it render something : a list of the files’ names.
But no link and no thumbnails…
And I don’t succeed in using the link() function.
What I want to get is a list of links with for each of them, a thumbnail corresponding to the type of the file…

Not sure what you’re missing. If you have defined file extension in media.yaml, it should work. I just tried on my page:

 {{ file.link().html()|raw }}

And I’ve got linked thumbnail rendered on page :thinking:

You’re right, after deleted the .odt files and clear the cache, it works.
So is there a bug with odt files ?
In user/config/media.yaml, I write :

  odt:
    type: file
    thumb: media/thumb-odt.png
    mime: application/vnd.oasis.opendocument.text

I’m a bit lost :slight_smile: If you say it works, what bug are you talking about? :slight_smile:

It seems to be all right (even with odt files).
I don’t understand, but the solution was to clear the cache “compiled/config”.
Thank you for your help.