Menu

Tree [0583e5] main /
 History

HTTPS access


File Date Author Commit
 static 2021-12-20 Maurizio Paglia Maurizio Paglia [0583e5] Delete your_file.css
 .gitignore 2021-03-10 Maurizio Paglia Maurizio Paglia [9f83f8] Initial commit
 LICENSE 2021-03-10 Maurizio Paglia Maurizio Paglia [9f83f8] Initial commit
 README.md 2021-08-09 Maurizio Paglia Maurizio Paglia [02141c] Update README.md
 __init__.py 2021-03-17 Maurizio Paglia Maurizio Paglia [c0b646] Update __init__.py
 static_comments_plus.py 2021-05-19 Maurizio Paglia Maurizio Paglia [5d6a46] Add files via upload

Read Me

Static Comments Plus

A more complete version of Pelican Static Comments plugin.

⚠️ a PHP capable hosting server is needed if you desire to use the send-comment utility!

This plugin allows you to add static comments to articles.

By default the plugin looks for any comments of each article in a local file named
Pelican_root_dir/comments/{slug}.md or .rst, where {slug} is the value of the slug tag for the
article. The comment files should be formatted using markdown (.md) or reST (.rst).

Users comments can be delivered to your mailbox (a PHP capable server needed) and you have to add it manually to the a.m. file. Basically it is
the same logic of a moderation queue...

The plugin can be activated setting the parameter STATIC_COMMENTS_PLS to True.

Set the STATIC_COMMENTS_DIR parameter to the directory path where comments
are located. Default is comments.

Set the STATIC_COMMENTS_SOURCE parameter to MD if you prefer to use Markdown for formatting. Default is RST.

PHP comment delivery and HTML form

In order to use the PHP part of this plugin you need to copy static/php/send-comment.php file into your theme folder and configure send-comments.php changing $to = 'yourname@yourdomain.com'; with the real email address that should receive comments.

Then you need to configure your article.html template adding - before the footer - a piece of code similar to:

{% if STATIC_COMMENTS_PLS and article.status != "draft" %}
   {% include comments.html %}
{% endif %}

Your comments.html will be something similar to this:

<section id="comments" class="body">
  <h3>{{ 'Comments'|gettext(DEFAULT_LANG) }}</h3>
  {{ article.metadata.static_comments }}
  <hr>
  {% include comments_form.html %}
</section>

and, finally, your comments_form.html should be similar to

<form action="script.php">
       <input type="hidden" id="title" name="title" value="{{ article.metadata.title }}" readonly><br>
    <label for="fname">{{ 'Name'|gettext(DEFAULT_LANG) }}:</label><br>
       <input type="text" id="fname" name="fname" required><br>
       <small>{{ 'This field is mandatory'|gettext(DEFAULT_LANG) }}</small><br><br>
    <label for="web">{{ 'Website'|gettext(DEFAULT_LANG) }}:</label><br>
       <input type="text" id="web" name="web"><br>{{ 'Submit'|gettext(DEFAULT_LANG) }}">
</form>

A working example can be found in Pelican Z theme

Enjoy!

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.