pmoreno-rodriguez / grav-theme-future2021

Future Imperfect theme by HTML5UP ported from scratch to Grav. Version 2021
Other
20 stars 10 forks source link

Bug with new "Show Image" functionality in default.html.twig #36

Closed huteck closed 1 year ago

huteck commented 1 year ago

Hi,

in default.md it references "Show Images" as show_pageimage but in default .html.twig it's querying "show_image" in if-clause. When that is changed to show_pageimage it properly hides the primary image. Without that fix the image is always shown.

https://github.com/pmoreno-rodriguez/grav-theme-future2021/blob/51ef5e271252728404ed9bbfe326a54e0299754e/templates/default.html.twig#L28

huteck commented 1 year ago

Reference of a default.md

image

pmoreno-rodriguez commented 1 year ago

Hi @huteck The show_image variable references the blueprint's show_pageimage variable at the top of the default.html.twig file as follows:

{# Define if the primary image and the attributes of width and height are shown #}
{% set show_image = header_var('show_pageimage')|defined(true) %}

By default, if show_pageimage is not set, it is set to 'true', saving the value in show_image.

To deactivate the image of a page you have two options: 1) On each page, set the value of show_pageimage to False (in Admin panel, you can do it with the Show Image button) 2) You can modify the default.html.twig file, on line 4 to the following:

{% set show_image = header_var('show_pageimage')|defined(false) %}
huteck commented 1 year ago

Hi. that is really strange. The first time I tried it after downloading it only worked after I switched to show_pageimages but now it also works. maybe the page still got loaded from cache. Sorry for the confusion and thanks for the explanation