Skip to content
A plugin for pelican that will serialize pelican_comment_system in a jinja template so that comment data can be easily received by react/vue
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

A companion filter for Pelican Comment System

Pelican is a fantastic Python powered static site generator. It's mature, has many plugins and is pretty fast! Maybe not Hugo fast, but fast enough for a Python enthusiast :)

It's got some cantankerous old bumps though. The class objects generated by Pelican are complex and are not easily serializable for fancy front-end frameworks like VueJS or React. The same problem is inherited by Pelican Comment System.

Fear not! I have written a jinja2 filter that will solve this problem for PCS :D

Clone this repository into whatever Pelican plugins directory you're using, add pcs-serializer to your list of plugins in your, then in your article.html template, use the filter article.comments like so:

  comments="{{ article.comments | cserializer | e }}">

Note: the e filter is required after cserializer for escaping the resulting JSON made by the filter. Check your component props, you should now have a shiny new JSON string that you can decode into a useful JS object.

You can’t perform that action at this time.