getgrav / getgrav/grav-plugin-comments

Active comments per page in the frontmatter

Open
#93 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
54
Forks
26
PR merge metrics
No merged PRs in 30d

Description

I am trying to only active the comments function when to `active` flag in the frontmatter is set. This is not yet implemented and I think this might not be possible at all. It would be nice, if you could give me some hints:

1. onPluginsInitialized Event will check if the route is set in the config and enables the plugin
2. onFormPageHeaderProcessed Adds the form to the page header
3. onPageInitialized Gives us the page object along with its header settings

The problem is, that I must check if the plugin should be enabled in step 3. But I cannot add the form from step 1 at this late step. This means I can only enable/disable the comments plugin from uris?

Enabling the plugin on a per-page basis has multiple usecases:
* You dont need to edit the plugin config every time, just the page
* You do not need to use uris, which might change
* You can also enable comments for a special page template, e.g. only for blog posts, no matter at which route they are
* This plugin will only be active, where is should. currently you can send a POST to a page without comments form and a comment will be silently added to the data directory

Is there a way to add a form to the page header at a later time?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the named onPluginsInitialized, onFormPageHeaderProcessed, and onPageInitialized events in the comments plugin and how page frontmatter is exposed. Determine whether the form can be added after page initialization; done means establishing a supported per-page activation path or documenting why the existing URI/config approach is required.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.