-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Thanks for the plugin. I really like it.
- After some starting problems I managed to get it working on my blog pages on a stable basis (which includes regular cache clearing of my site).
- Did some enhancements:
- Limited the number of shown comments to e. g. 10
- Implemented a "moderated" field to be able to control which comments are shown or not
- Despite all efforts to get it working on modular subpages it won't work properly:
- The comments are shown on the modular, not on the subpage
- the path "/projekte#subpage" is changed to "/projekte/_subpage"
- My guess: it is about the "action="…" definition
For now I have no clue what to do next. Help/ideas are heartely welcomed!
Below please find my adapted comments.html.twig:
{% if enable_comments_plugin %}
{% set scope = scope ?: 'data.' %}
<h3>{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}</h3>
<p class="small">Mit der Nut­zung ertei­len Sie uns Ihre Ein­willi­gung zur Spei­che­rung und Ver­arbei­tung Ihrer Daten (<a href="/kontakt#datenschutz">Daten­schut­zerklä­rung</a>). Ihr Kom­men­tar erscheint erst nach Frei­gabe. Schauen Sie daher später noch einmal herein.</p>
<form name="{{ grav.config.plugins.comments.form.name }}"
action="{{ grav.config.plugins.comments.form.action ? base_url ~ grav.config.plugins.comments.form.action : page.url }}"
method="{{ grav.config.plugins.comments.form.method|upper|default('POST') }}">
{% for field in grav.config.plugins.comments.form.fields %}
{% set value = form.value(field.name) %}
{% if field.evaluateDefault %}
{% set value = evaluate(field.evaluateDefault) %}
{% endif %}
{% if config.plugins.login.enabled and grav.user.authenticated %}
{% if field.name == 'name' %}
<input type="hidden" name="{{ (scope ~ field.name)|fieldName }}" value="{{grav.user.fullname}}">
{% elseif field.name == 'email' %}
<input type="hidden" name="{{ (scope ~ field.name)|fieldName }}" value="{{grav.user.email}}">
{% else %}
<div>
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
</div>
{% endif %}
{% else %}
<div>
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
</div>
{% endif %}
{% endfor %}
{% include "forms/fields/formname/formname.html.twig" %}
<div class="buttons">
{% for button in grav.config.plugins.comments.form.buttons %}
<button class="button" type="{{ button.type|default('submit') }}">{{ button.value|t|default('Submit') }}</button>
{% endfor %}
</div>
{{ nonce_field('form', 'form-nonce')|raw }}
</form>
<div class="alert">{{ form.message }}</div>
{% if grav.twig.comments|length %}
<h4>{{'PLUGIN_COMMENTS.COMMENTS'|t}}</h4>
<table id="comments">
{% for comment in comments|array_reverse|slice(0,10) %}
{% if comment.moderated == true %}
<tr>
<td>
<span class="fett">{{comment.text}}</span>
<br />
<span class="ital">({{comment.date|e}} {{'PLUGIN_COMMENTS.BY'|t}} {{comment.author}})</span>
</td>
</tr>
{% endif %}
{% endfor %}
</table>
{% endif %}
{% endif %}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels