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.

General

Listing media in a subpage not updating when media changes

Started by nix 3 years ago · 1 replies · 262 views
3 years ago

Hello,

In a modular page, I am including a url list of the media of a subpage _replay containing mp3s. I want the mp3s to be updated with ftp without touching the md file in the folder.

The problem is adding a file, or modifying a filename doesn't update the list of urls. And I need to edit the markdown file in order to update the list.

My replay folder has a markdown file with this content:

YAML
---
title: Replay
cache_enable: false
never_cache_twig: true
---

# test

I have tested to include the file listing in the modular page with two methods: using a specific twig template or a direct loop (my listing is going in a javascript var sonicReplay):

TWIG
{% for module in page.collection() %}
  {% if module.slug == '_replay' %}
    {% set content_html = module.content|e('js') %}
      contentReplay += '{{content_html}}'
    {% endif %}
{% endfor %}

with this twig template:

TWIG
{% for file in page.media.all|sort %}
  {{file.url}}<br>
{% endfor %}

or the direct loop in the modular page

TWIG
{% for file in pages.find('/2023/_replay').media.all|sort %}
  contentReplay += '{{file.url|e('js')}}';
{% endfor %}

I have tried different cache methods : normal, folder or file, and activated the option "add timestamp to media files"

Do you have an idea of what I can try?
Thanks

3 years ago

For info:

Using the system configuration media->enable timestamp on media and caching -> cache method : all files timestamp seems to work on the hosting environment, even though it was not working in my development environment (osx 10.15).

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 76 8 hours ago
General · by pamtbaau, 13 hours ago
1 47 12 hours ago
General · by Andy Miller, 1 day ago
0 44 1 day ago
General · by Marcel, 12 months ago
6 346 5 days ago
General · by Duc , 5 days ago
3 40 5 days ago