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.

Archive

Exclude header image from getting displayed by the «simple gallery» cookbook

Started by Muut Archive 9 years ago · 0 replies · 368 views
9 years ago

Hello everyone,

I'm planning to apply the «simple gallery» cookbook for a Grav powered portfolio site. Is there any way I could exclude a single image (the header image) from getting rendered?

My current workaround is by putting each of the gallery's header image inside their own respective subfolder called _img and displaying them through hardcoded <img> tag in the Twig template.

I'm just wondering if there is another efficient way to do this. 😄

By the way, here is how I hardcoded the header image:

TWIG
{% if header_image %}
    <div>
        {% set the_the_the_current_folder = page.filePathClean|rtrim('md') %}
        {% set the_the_current_folder = the_the_the_current_folder|rtrim('.') %}
        {% set the_current_folder = the_the_current_folder|rtrim(page.template) %}
        <img src="{{ base_url_absolute }}/{{ the_current_folder }}/_img/header.jpg">
    </div>
{% endif %}

Bear with me, I'm no programmer. 😄

👍 1

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1282 9 years ago
Archive · by Muut Archive, 9 years ago
2 889 9 years ago
Archive · by Muut Archive, 9 years ago
2 4019 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1078 9 years ago