hibbitts-design / grav-theme-quark-open-publishing

A customized version of the Quark theme with Git Sync and 'chromeless' mode support.
http://demo.hibbittsdesign.org/grav-open-publishing-quark/
MIT License
21 stars 13 forks source link

Enable comments for blog posts? #3

Closed zaszlo closed 6 years ago

zaszlo commented 6 years ago

I would like to use the comments plugin by the grav team. It is enabled (see it from admin panel) and I see it is included in this theme in templates/partials/blog-item.html.twig:

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

What could be the reason that it is not appearing on the bottom of the blog posts?

Thanks!

paulhibbitts commented 6 years ago

Hi @zaszlo , I just downloaded the current Open Publishing Space skeleton (which includes the Quark Open Publishing theme) and installed the Comments Plugin and it seemed to work:

2018-09-02_08-10-37

UPDATE: Doing some more testing it seems that some posts display comments and some do not... looking at the original Quark theme it has the same issue. Try changing that original code chunk to the below and please let me know if it works as expected:

    {% if config.plugins.comments.enabled %}
        {% include 'partials/comments.html.twig' %}
    {% endif %}

BTW, looking at the Antimatter theme I am unsure why in Quark page.header.continue_link is sameas(true) was added.

zaszlo commented 6 years ago

Thanks for the feedback, tried with the modified snippet, but still the comment section didn't appear... any other hints on how to debug what is going on?

paulhibbitts commented 6 years ago

Did you clear the cache for your test (system.yaml file, both caches or via Admin Panel)? Also confirm that your active theme is the theme file you are editing - thanks!

zaszlo commented 6 years ago

I did clear the cache with method "all" and am using the My Quark Theme with only minor additions in templates copied from Quark Open Publishing: item.html.twig partials/blog-item.html.twig partials/navigation.html.twig

The partials having the edit that you suggested here. But did that edit on both My theme and on the Quark Open Publishing.

...
        {% else %}
            {{ page.summary }}
        {% endif %}
    </div>

    {% if config.plugins.comments.enabled %}
        {% include 'partials/comments.html.twig' %}
    {% endif %}

</div>

{# added check for content display flag - hibbittsdesign.org #}
{% if not (grav.uri.param('chromeless')) %}
...

Interestingly if I add

    {% if config.plugins.comments.enabled %}
        OK
        {% include 'partials/comments.html.twig' %}
    {% endif %}

The OK is rendered fine. I installed the comments plugin from admin console and checked that it is enabled, did not touched it otherwise.

paulhibbitts commented 6 years ago

Hmm... I've made a new release of the theme with the above fix, perhaps try that?

I've also released a new Open Publishing Space skeleton with the new theme, you could download and test that with the Comments Plugin to make sure there are no issues with your specific setup etc. https://getgrav.org/downloads/skeletons

zaszlo commented 6 years ago

It was my bad that I didn't created a new comments.yaml into my config/plugins and didn't changed the default enabled route from blog to home.

paulhibbitts commented 6 years ago

Glad you got things going!

LeMoussel commented 4 years ago

Hi Paul,

I'm tested Open Publishing Space skeleton with the Comments Plugin.

image

I got this error:

Whoops \ Exception \ ErrorException (E_NOTICE) Trying to access array offset on value of type null

image

I copy the contents of user/plugins/comments/comments.yaml in user/config/plugins/comments.yaml. However, I notice that there is no user/data/comments folder. This seems normal to me because there are no comments on the articles.

It seems the error is in the "comments" plugin: Issue #81 Grav 1.6.19 on PHP 7.4.1 is broken (again?)

I applied PR #82 Fix error when there is no comment. That seems to be okay.

paulhibbitts commented 4 years ago

Thanks for letting me know @LeMoussel 🙂