Unable to display Comments plugin in Gantry 5 Helium theme

Hi everyone,

I’m trying to add comments to articles in GRAV CMS (latest version) using the Gantry 5 Helium theme (latest version) and Comments plugin. I’ve encountered some issues getting the comments to display.

Current setup:

  • Latest GRAV CMS
  • Latest Gantry 5 Helium theme
  • Latest Comments plugin (installed and enabled)

What I’ve tried:

  1. Adding comments via Custom HTML particle in Gantry admin:
{{ grav.twig.comments|raw }}

and

{{ grav.twig.render('partials/comments.html.twig', {page: page})|raw }}

and

{% if config.plugins.comments.enabled %}
    {% include 'partials/comments.html.twig' with {'page': page} %}
{% endif %}
  1. Debugging shows that neither config nor page objects are available in the particle context (tried {{ dump(config.plugins.comments) }} and {{ dump(page) }} - both empty).

  2. Checked for template files:

  • No blog-item.html.twig in /user/themes/g5_helium/templates/partials/
  • No relevant templates in /user/themes/g5_helium/particles/
  • Only YAML files present in /layouts and /blueprints

Questions:

  1. What’s the correct way to integrate Comments plugin with Gantry 5 Helium theme?
  2. How can we access the GRAV page context within Gantry particles?
  3. Is there a specific template override needed for the Helium theme?

Any help would be greatly appreciated. Thank you!

I would love to have more time to help you, but right now it is impossible. However, I can tell you that in Gantry you have to specify the content inside the {% block particle %} blocks, and the content of the .yaml file is called with particle.xxx (where xxx is a variable specified in .yaml).
For example, the particle sample.html.twig in its .yaml file has this:

name: Sample Content
description: Displays Sample Content
type: particle
icon: far fa-edit

configuration:
caching:
type: static

form:
fields:
enabled:
type: input.checkbox
label: Enabled
description: Globally enable the particle.
default: true

image:
type: input.imagepicker
label: Image
description: Select the main image.
overridable: false

Look how it calls the image variable inside the twig file:

{% block particle %}
....
....
{% if particle.image %}<img src="{{ url(particle.image) }}" class="logo-large" alt="{{ particle.headline|e }}" />{% endif %}
....
{% endblock %}

That is, to integrate the comments plugin content, you may need to make some custom settings to some particle, or create your own particle for it.

Check out the official documentation:
https://docs.gantry.org/gantry5/advanced/creating-a-new-particle

BTW, the Grav comment plugins are quite outdated. We’ll have to take a look at it to see if it’s still compatible with new versions of Grav.

Gantry is also in a stagnant development phase, but I hope to see new versions and bug fixes soon.

Volunteers needed!!

1 Like