gantry5 icon indicating copy to clipboard operation
gantry5 copied to clipboard

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

Open beamaria opened this issue 3 years ago • 2 comments

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

beamaria avatar Feb 07 '22 17:02 beamaria

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.

mahagr avatar Feb 08 '22 06:02 mahagr

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

beamaria avatar Feb 15 '22 15:02 beamaria