Display all images in folder for shortcode gallery plugin


I am fairly new to grav. I have used the plugin shortcode gallery plus plus for my site. So, for the plugin to work, the image links must be entered within the [gallery][/gallery] tags in the page markdown file. It works fine, but I’m trying to display all images within the page folder without having to add links to each image in the markdown file.

So I tried another code within the page twig.

{% extends ‘partials/base.html.twig’ %}
{% block content %}

<div class="content">
    <h1 class="page-title">{{page.title}}</h1>
    <hr class="header-hr">
    {{ page.content|raw }}

{% for image in page.media.images %}

{% endfor %}


{% endblock %}

This works fine and displays all images within the page folder, but my problem is how and where to insert the [gallery][/gallery] tags for the plugin to work. I want the images to be displayed as thumbnails and open in modal pop up when clicked. The plugin does that.

Any help is much appreciated!

The shortcode provided by this plugin is intended for page markdown, not the Twig templates as you are asking about. At least according to its README file, it doesn’t provide any Twig invocations.

You can embed markdown in Twig and I’m guessing it will work for shortcodes too. Try Grav’s markdown custom Twig tag, put your [gallery][/gallery] in there.

Ah, you might be correct. I’ll check the link and give it another go to try and embed the tags in the twig :wink:

Thank you