grav-plugin-comments
grav-plugin-comments copied to clipboard
Nothing gets rendered - grav.twig.enable appears obsolete
The sample comments.html.twig shows:
{% if grav.twig.enable %}
Which never is set even when twig is enabled in config/system.yaml
33 process:
34 markdown: true
35 twig: true
I was able to make the comments come up by deleting the {% if grav.twig.enable %}
and it's corresponding {% endif %}
I'm not actually seeing that statement, only {% if grav.twig.enable_comments_plugin %}
and {% if grav.twig.comments|length %}
.
My comments are not only not rendering, now, but all previous comments seem to have been deleted, so I am grasping at straws here.
I had {% if grav.twig.enable_comments_plugin %}
too, in the file comments.html.twig
Replacing it by {% if comments.enabled %}
seems to be correct (as seen in partial_item.html.twig in my current theme which is Bootstrap-blog).
With this change, HTML elements are now showing up.
I still have to find about the POST function not working, and eventually see if submitted comments are showing up then.
@diagone3000 and @jeremycherfas : Any news ? I've installed the plugin but it's broken : https://github.com/getgrav/grav-plugin-comments/issues/78 Seems that the last 1.6 version of GRAV killed this plugin.
in comments.html.twig replace
{% if grav.twig.enable %}
to this
{% if config.plugins.comments.enabled %}
The form will then show up.
However it still have some issues, like button name and the fact that it does not save the comments
@sospcie What line is it ? I don't find it. Probably because I already modified the plugin's partial. It think it's the first line, isn't it ? I had changed it to :
{% if config.plugins.comments %}
But still, the plugin makes my pages to throw en error (Crikey, as I said in https://github.com/getgrav/grav-plugin-comments/issues/78).
@Romarain Yes, that was the line. However, since my post I have done some test, with the default template, and the comment plugin seems to work. So need to do some more debugging why with other templates there is an issue. I did the test using latest GRAV 1.6.8
@sospcie Hi. I'm actually trying to make that plugin to work, and can't. I've tested, in a root page called "Test", to include the comments template :
{% include "partials/comments.html.twig" %}
and it shows the form. But no matter I send the message, it isn't saved. I've looked into the /data folder, nothing is there.
To make the comments POST, "grav."part should be removed from the pages upper section eg. grav.config.plugins.comments.form.action => config.plugins.comments.form.action, and so on
@sospcie Hi. I'm actually trying to make that plugin to work, and can't. I've tested, in a root page called "Test", to include the comments template :
{% include "partials/comments.html.twig" %}
and it shows the form. But no matter I send the message, it isn't saved. I've looked into the /data folder, nothing is there.
@Kalmera74 Unfortunately, this doesn't change anything. I've replace all the occurences in my custom /partials/comments.html.twig
, and also in the custom comments.yaml
, but it still doesn't work. Do we need to edit the PHP file too ?
@Romarain There should be no need to edit the php file only editing the twig file sould have been enough. It is possible that your theme is also the part of the problem, but I am not sure.
@Kalmera74 Do you use the enable_on_routes:
option in the YAML of the plugin ?
When I don't use it, the form does appear (but nothing works as I said), but when I activate it for a route, it results in a Crikey : https://github.com/getgrav/grav-plugin-comments/issues/78
I had an issue with the comment code not showing up on the item page. After I did the below, it showed up.
in comments.html.twig replace
{% if grav.twig.enable %}
to this
{% if config.plugins.comments.enabled %}
The form will then show up.
However it still have some issues, like button name and the fact that it does not save the comments
but then when I entered and submitted a comment no comment appeared in Admin, nothing in data/comments.
I then tried the below (removing grav. from everywhere in the twig file) and that also did not solve anything.
To make the comments POST, "grav."part should be removed from the pages upper section eg. grav.config.plugins.comments.form.action => config.plugins.comments.form.action, and so on
Then I commented out the enable_on_routes: - also no comments posted
I've added email from/to to Email plugin. (however, I would think this would only have anything to do with the email and not with storing the comment).
Any other ideas? I am on localhost with the default Quark theme.
UPDATE: it does look like it has something to do with the email not functioning. If I disabled Email plugin, all works as expected.
@replayshot
If I disabled Email plugin, all works as expected.
I tested by just removing the form - email:
field from the YAML, but it still probably try something with the email plugin in the PHP. Interesting to know that disabling the email plugin improve things.
I'm struggling with this problem now. Tried all of the above, even removing the email field and disabling the email plugin but it's still not working - the form displays, but submitting a comment doesn't seem to do anything.
Granted, this was written before we had a lot of helper functions, but it does work even in latest Grav 1.7 with:
{% if grav.twig.enable_comments_plugin %}