A single-file, well-apportioned, embedded comment toolkit written in PHP for use with static sites using SQLite.
| .gitignore | ||
| index.php | ||
| LICENSE | ||
| README.md | ||
| test.html | ||
RPM Comments
A single-file, well-apportioned, embedded comment toolkit written in PHP for use with static sites using SQLite.
Installation
- Download the latest version of the index.php file, or the latest release ZIP.
- Upload the file to your server; ideally host the file on it's own subdomain or in a subdirectory. (eg,
https://comments.example.com/index.phporhttps://example.com/comments/index.php) - Access RPM Comments at the URL you specified in step 2. A config.php will be automatically generated, and, if you're using Apache, an .htaccess fill will also be created.
- Edit the config.php file to your liking. Make sure trusted_ip_header and allowed_domains have been set for embedding to work. The DB file path must be outside of the web root for security reasons.
- Access RPM Comments at the URL you specified in step 2 again and create your first admin user.
- You're expected to have a reverse proxy in front of RPM Comments to manage bot-blocking as there is no built-in spam prevention.
Usage
RPM Comments is a single-file PHP component that can be embedded in any static site. No dependencies are required.
Embedding
To embed RPM Comments, add the following code to your HTML in the <head> section. If you're using Apache with mod_rewrite, you can use the .htaccess file to auto-generate the URL. If you're using another server, you'll need to manually specify the rewrite rules.
<script src="https://comments.example.com/comment.js"></script>
You can also not use clean URLs and specify the full URL to the script.
<script src="https://comments.example.com/index.php?q=comment.js"></script>
Then place the following code where you want the comments to appear.
<rpm-comments
server="https://comments.example.com"
id="example-page"
style="list-style:none;padding-left:0;">
</rpm-comments>
The following attributes are supported:
| Attribute | Description |
|---|---|
server |
The URL to the RPM Comments server. |
id |
The page ID to load comments for. This is used to filter comments by page. |
style |
The style attribute for the <rpm-comments> element. |
Moderation
You can visit the admin page at /admin or /index.php?q=admin to manage comments.