Grav with Quark - Comments Plugin not loading

I’m running a fresh install of grav with the quark theme. I use the blog item. Grav is running fine. I tried several times to install the comment plugin always with the result of not showing up on my pages.

My page configuration:

Main Page
/blog -> blog

Blog Entry 1
/blogentry1 -> item

Blog Entry 2
/blogentry2 -> item

The content of my comments.yaml in user/config/plugins:

enabled: true
enable_on_routes:
  - /blog
  - /item
  - /blog
  - /item

disable_on_routes:
  - /blog/blog-post-to-ignore
  - /ignore-this-route
form:
  name: comments
  fields:
    -
      name: name
      label: PLUGIN_COMMENTS.NAME_LABEL
      placeholder: PLUGIN_COMMENTS.NAME_PLACEHOLDER
      autocomplete: true
      type: text
      validate:
        required: true
    -
      name: email
      label: PLUGIN_COMMENTS.EMAIL_LABEL
      placeholder: PLUGIN_COMMENTS.EMAIL_PLACEHOLDER
      type: email
      validate:
        required: true
    -
      name: text
      label: PLUGIN_COMMENTS.MESSAGE_LABEL
      placeholder: PLUGIN_COMMENTS.MESSAGE_PLACEHOLDER
      type: textarea
      validate:
        required: true
    -
      name: date
      type: hidden
      process:
        fillWithCurrentDateTime: true
    -
      name: title
      type: hidden
      evaluateDefault: grav.page.header.title
    -
      name: lang
      type: hidden
      evaluateDefault: grav.language.getLanguage
    -
      name: path
      type: hidden
      evaluateDefault: grav.uri.path
  buttons:
    -
      type: submit
      value: PLUGIN_COMMENTS.SUBMIT_COMMENT_BUTTON_TEXT
  process:
    -
      email:
        subject: PLUGIN_COMMENTS.EMAIL_NEW_COMMENT_SUBJECT
        body: '{% include ''forms/data.html.twig'' %}'
    -
      addComment:
    -
      message: PLUGIN_COMMENTS.THANK_YOU_MESSAGE
    -
      reset: true

The contents of user/themes/quark/templates/partials/blog-item.html.twig:

  GNU nano 2.9.3                                                                                                                                        blog-item.html.twig                                                                                                                                                   

<div class="content-item h-entry">

{% if not hero_image_name %}
    <div class="content-title text-center">
        {% include 'partials/blog/title.html.twig' with {title_level: 'h2'} %}
        {% if page.header.subtitle %}
        <h3 >{{ page.header.subtitle }}</h3>
        {% endif %}
        {% include 'partials/blog/date.html.twig' %}
        {% include 'partials/blog/taxonomy.html.twig' %}
    </div>
{% endif %}
    <div class="e-content">
        {{ page.content|raw }}
    </div>

    {% if page.header.continue_link is same as(true) and config.plugins.comments.enabled %}
         {% include 'partials/comments.html.twig' %}
    {% endif %}
</div>

<p class="prev-next text-center">
    {% if not page.isLast %}
            <a class="btn" href="{{ page.prevSibling.url }}"><i class="fa fa-angle-left"></i> {{ 'THEME_QUARK.BLOG.ITEM.PREV_POST'|t }}</a>
    {% endif %}

    {% if not page.isFirst %}
        <a class="btn" href="{{ page.nextSibling.url }}">{{ 'THEME_QUARK.BLOG.ITEM.NEXT_POST'|t }} <i class="fa fa-angle-right"></i></a>
    {% endif %}
</p>

I’ve spent several hours trying different settings, but i can’t get the comment section to show up. On the other hand i can’t get the grav frontend to crash either. It seems the comment plugin isn’t active at all (allthough it is set to enabled).

@zaphodbeeblebrox, A few notes:

  • For some reason the template ‘/themes/quark/templates/partials/blog-item.html.twig’ is testing whether the value of 'page.header.continue_link" is set to true. It has to do with the style of the title of the blog page item. No idea what that has to do with a comment form…

    Possible fixes:

    • Add continue_link: true to every blog item. Not that great…
    • Or, better, create an inherited theme, copy ‘/themes/quark/templates/partials/blog-item.html.twig’ into your own theme and change the if-statment on line 17 as follows:
      {% if config.plugins.comments.enabled %} 
        {% include 'partials/comments.html.twig' %}
      {% endif %}
      
  • By default, the plugin will add the form to pages (if included in its template) with path ‘/blog’ and child pages of ‘/blog’.

    Your folder structure seems a bit odd. Maybe it is just a matter of ill formatting… Just to be sure, the default (and easiest) folder structure should look like:

    /pages/
       blog/
          blogitem1/
             item.md
          blogitem2/
             item.md
          blog.md
    
  • In ‘comments.yaml’ you have the following value:

    enable_on_routes:
      - /blog
      - /item
      - /blog
      - /item
    

    Would you mind sharing what you are trying to achieve with duplicate entries and with entries ‘/item’.

Hope this helps…

@anon76427325

Thanks for your answer. Before creating a inherited team, i added continue_link: true to every page. It hasn’t helped, the comment section isn’t showing up. I now thought switching back to Antimatter could help (i used this years ago on another project) but after switching back to the theme Antimatter also no comment section is showing up.

I removed the duplicate entries for enable_on_routes, but without luck.

My blog structure is exactly like you’ve mentioned it:

/pages/
   blog/
      blogitem1/
         item.md
      blogitem2/
         item.md
      blog.md

@zaphodbeeblebrox, Odd…

Are you sure that the {% include 'partials/comments.html.twig' %} statement is reached?

Would you mind adding the following to ‘themes/quark/template/partials/blog-item.html.twig’ right above line 17 (the if-statement) and share what the results are:

{{ var_dump(
    page.header.continue_link,
    config.plugins.comments.enabled,
    page.header.continue_link is same as(true) and config.plugins.comments.enabled
) }}