Discussion Helper

The {{discussion}} helper adds a hierarchical discussion/comment system to any page. Comments are stored in JSON files alongside the page content, with IP tracking and XSS protection built-in.

Features

Usage

Simply add the helper to any page:

 {{discussion}}

The helper will automatically:

  1. Generate a form for posting new comments
  2. Load and display existing comments in a threaded format
  3. Allow users to reply to any comment

Data Storage

Discussion data is stored in a JSONL (JSON Lines) file with the same name as the page:

JSONL Format

The discussion file uses JSON Lines format - one JSON object per line. This allows for efficient appending and streaming:

```jsonl {"id":"abc123","parentId":null,"timestamp":"2025-11-20T17:00:00.000Z","ip":"127.0.0.1","author":"John Doe","content":"This is a comment"} {"id":"def456","parentId":"abc123","timestamp":"2025-11-20T17:05:00.000Z","ip":"192.168.1.1","author":"Jane Smith","content":"This is a reply"} {"id":"ghi789","parentId":null,"timestamp":"2025-11-20T17:10:00.000Z","ip":"127.0.0.1","author":"Anonymous","content":"Another top-level comment"} ```

Each line is a complete JSON object representing one comment. The parentId field creates the thread hierarchy (null for top-level comments).

Security

All user input is automatically sanitized:

Rate Limiting:

File Size Limits:

Try it Out

Post a comment below to see the discussion system in action!

{{discussion}}