Hi all,
I’m new to this forum and Grav, migrating my old, and unfinished, web to Grav.
I’m trying to active comments for my blog section over a Deliver theme.
I install comment with CLI tool (bin/grav install comments
), copy comments.yaml to user/config/plugin/comments/
in order to customize and modify blog_item.html.twig to show comments.
I change only enable_on_routes and disable_on_routes in comments.yaml:
enable_on_routes:
- '/diario-e'
disable_on_routes:
- '/diario-e/entradas-sin-comentarios'
My file tree on grav looks in this way:
$ ll pages/
total 4,0K
drwxrwsr-x 1 razlobo daemon 104 ago 30 13:09 01.home
drwxr-sr-x 1 razlobo daemon 90 ago 30 13:07 02.servicios
drwxr-sr-x 1 razlobo daemon 22 ago 28 22:55 03.tienda-e
drwxr-sr-x 1 razlobo daemon 252 sep 4 13:27 04.diario-e
lrwxrwxrwx 1 razlobo daemon 12 ago 30 14:22 06.blog -> 04.diario-e/
drwxr-sr-x 1 razlobo daemon 104 ago 28 13:24 10.sobre-mi
drwxr-sr-x 1 razlobo daemon 104 ago 28 22:31 11.contactar
drwxr-sr-x 1 razlobo daemon 20 ago 28 23:06 _aviso-legal
drwxr-sr-x 1 razlobo daemon 16 ago 28 22:49 error
I make a link from blog to diario-e in order to check default route and, comments runs well when access by site/blog/post-entry
(and not when I go by site/diario-e/post-entry
).
I active debugger to try to find the problem, but I’m not a programmer and I can’t see it, but I think that is something related with the way that comments “charges” enabled routes. See the debugger comment plugin section:
comments
array:5 [
"enabled" => true
"enable_on_routes" => array:1 [
0 => "/blog"
]
"disable_on_routes" => array:2 [
0 => "/blog/blog-post-to-ignore"
1 => "/ignore-this-route"
]
"form" => array:4 [
"name" => "comments"
"fields" => array:7 [
0 => array:6 [
"name" => "name"
"label" => "PLUGIN_COMMENTS.NAME_LABEL"
"placeholder" => "PLUGIN_COMMENTS.NAME_PLACEHOLDER"
"autocomplete" => "on"
"type" => "text"
"validate" => array:1 [
"required" => true
]
]
1 => array:5 [
"name" => "email"
"label" => "PLUGIN_COMMENTS.EMAIL_LABEL"
"placeholder" => "PLUGIN_COMMENTS.EMAIL_PLACEHOLDER"
"type" => "email"
"validate" => array:1 [
"required" => true
]
]
2 => array:5 [
"name" => "text"
"label" => "PLUGIN_COMMENTS.MESSAGE_LABEL"
"placeholder" => "PLUGIN_COMMENTS.MESSAGE_PLACEHOLDER"
"type" => "textarea"
"validate" => array:1 [
"required" => true
]
]
3 => array:3 [
"name" => "date"
"type" => "hidden"
"process" => array:1 [
"fillWithCurrentDateTime" => true
]
]
4 => array:3 [
"name" => "title"
"type" => "hidden"
"evaluateDefault" => "grav.page.header.title"
]
5 => array:3 [
"name" => "lang"
"type" => "hidden"
"evaluateDefault" => "grav.language.getLanguage"
]
6 => array:3 [
"name" => "path"
"type" => "hidden"
"evaluateDefault" => "grav.uri.path"
]
]
"buttons" => array:1 [
0 => array:2 [
"type" => "submit"
"value" => "PLUGIN_COMMENTS.SUBMIT_COMMENT_BUTTON_TEXT"
]
]
"process" => array:4 [
0 => array:1 [
"email" => array:2 [
"subject" => "PLUGIN_COMMENTS.EMAIL_NEW_COMMENT_SUBJECT"
"body" => "{% include 'forms/data.html.twig' %}"
]
]
1 => array:1 [
"addComment" => null
]
2 => array:1 [
"message" => "PLUGIN_COMMENTS.THANK_YOU_MESSAGE"
]
3 => array:1 [
"reset" => true
]
]
]
"comments" => array:4 [
"enabled" => true
"enable_on_routes" => array:1 [
0 => "/diario-e"
]
"disable_on_routes" => array:2 [
0 => "/diario-e/entradas-sin-comentarios"
1 => "/blog"
]
"form" => array:4 [
"name" => "comments"
"fields" => array:7 [
0 => array:6 [
"name" => "name"
"label" => "PLUGIN_COMMENTS.NAME_LABEL"
"placeholder" => "PLUGIN_COMMENTS.NAME_PLACEHOLDER"
"autocomplete" => "on"
"type" => "text"
"validate" => array:1 [
"required" => true
]
]
1 => array:5 [
"name" => "email"
"label" => "PLUGIN_COMMENTS.EMAIL_LABEL"
"placeholder" => "PLUGIN_COMMENTS.EMAIL_PLACEHOLDER"
"type" => "email"
"validate" => array:1 [
"required" => true
]
]
2 => array:5 [
"name" => "text"
"label" => "PLUGIN_COMMENTS.MESSAGE_LABEL"
"placeholder" => "PLUGIN_COMMENTS.MESSAGE_PLACEHOLDER"
"type" => "textarea"
"validate" => array:1 [
"required" => true
]
]
3 => array:3 [
"name" => "date"
"type" => "hidden"
"process" => array:1 [
"fillWithCurrentDateTime" => true
]
]
4 => array:3 [
"name" => "title"
"type" => "hidden"
"evaluateDefault" => "grav.page.header.title"
]
5 => array:3 [
"name" => "lang"
"type" => "hidden"
"evaluateDefault" => "grav.language.getLanguage"
]
6 => array:3 [
"name" => "path"
"type" => "hidden"
"evaluateDefault" => "grav.uri.path"
]
]
"buttons" => array:1 [
0 => array:2 [
"type" => "submit"
"value" => "PLUGIN_COMMENTS.SUBMIT_COMMENT_BUTTON_TEXT"
]
]
"process" => array:4 [
0 => array:1 [
"email" => array:2 [
"subject" => "PLUGIN_COMMENTS.EMAIL_NEW_COMMENT_SUBJECT"
"body" => "{% include 'forms/data.html.twig' %}"
]
]
1 => array:1 [
"addComment" => null
]
2 => array:1 [
"message" => "PLUGIN_COMMENTS.THANK_YOU_MESSAGE"
]
3 => array:1 [
"reset" => true
]
]
]
]
]
My last test was change enabled_on_routes directly on user/plugins/comments/comments.yaml
and it runs well on “/diario-e”.
So, this is a bug or there are something that I do bad?
So many thanks.
Best regards.
Salud y Revolución.
Lobo.