gantry / gantry5

:rocket: Next Generation Template / Theme Framework
http://gantry.org
1.04k stars 204 forks source link

Gantry5 and Grav: the custom HTML particle no longer processes twig #2999

Open beamaria opened 2 years ago

beamaria commented 2 years ago

Hi. I have a problem since updating my local Grav website to Gantry 5.5: the "Custom HTML" particle no longer processes twig. I used this code to display the related posts in sidebar:

<h2>RelatedPosts</h2>

<ul class="related-pages">
    {% for related_path, score in related_pages %}
        {% set related = grav['pages'].get(related_path) %}
        {% if related %}
            <li>
                {% if config.plugins.relatedpages.show_score %}
                    <span class="score">{{ score }}</span>
                {% endif %}
                <a href="{{ related.url }}" title="{{ related.title }}">{{ related.title }}</a>
            </li>
        {% endif %}
    {% endfor %}
</ul>

After ticking the "process twig option" (see attachment2) the titles of all the related articles were displayed correctly, now all I can see is the title between h2 tag (see attachment1)

Settings: Grav 1.7.29.1 Admin Panel 1.10.29 Gantry plugin 5.5.9

shot shot2
mahagr commented 2 years ago

I just tested this, and twig works just fine. I don't think related_pages is set, particles do not see variables set outside their scope.

beamaria commented 2 years ago

The related Pages Plugin is really difficult to configure... Basically I have the situation in the attachment. I have tried with every possible combination , but still I cannot have it working properly...Maybe the problem is given by having only one "Blog Layout" for all the articles, irrespectively from their category...

shot