grav-plugin-comments icon indicating copy to clipboard operation
grav-plugin-comments copied to clipboard

Nothing gets rendered - grav.twig.enable appears obsolete

Open mabushey opened this issue 5 years ago • 15 comments

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 %}

mabushey avatar Nov 14 '18 02:11 mabushey

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.

jeremycherfas avatar Jan 10 '19 14:01 jeremycherfas

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 avatar Feb 14 '19 14:02 diagone3000

@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.

Heraes-git avatar Mar 29 '19 00:03 Heraes-git

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 avatar Apr 16 '19 19:04 sospcie

@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).

Heraes-git avatar Apr 24 '19 21:04 Heraes-git

@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 avatar Apr 25 '19 13:04 sospcie

@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.

Heraes-git avatar Aug 02 '19 13:08 Heraes-git

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 avatar Sep 12 '19 12:09 Kalmera74

@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 ?

Heraes-git avatar Sep 13 '19 16:09 Heraes-git

@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 avatar Sep 16 '19 06:09 Kalmera74

@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

Heraes-git avatar Sep 16 '19 15:09 Heraes-git

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 avatar Oct 30 '19 11:10 replayshot

@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.

Heraes-git avatar Nov 06 '19 02:11 Heraes-git

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.

failuretolaunch avatar Nov 18 '19 22:11 failuretolaunch

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 %}

rhukster avatar Sep 10 '20 22:09 rhukster