Please enable JavaScript to view the comments powered by Disqus.

Enabling Comments in WriteFreely (Hacky)

Commenting seems to be a feature lacking in WriteFreely. As a blog author, I want to know your opinions on my posts. Do you agree with what I wrote? Do you know something I don't? Was I wrong in certain things?

Disqus came to mind because I've seen it on many sites. The installation is supposedly hassle-free:

  1. Sign up
  2. Create a site on Disqus
  3. Embed the JavaScript code
  4. Voila!

I added the JS snippet into the “Post Signature.” Any contents in that field should be rendered in each post.

Well... apparently, any contents but <script></script> 🤦‍♂️

Sigh. That is quite limiting. It was an intentional decision in the name of security. I think the rationale was reasonable. But I'm not sure I agree with the solution. The argument is invalid when WriteFreely is in single-user mode.

I see a couple of ways to achieve my goal:

  1. Request for Custom Javascript to be enabled on single-user mode
  2. Modify the source, build, and deploy a. to disable sanitization on “Post Signature” b. to include the custom Javascript
  3. Find loopholes to inject custom Javascript

Option 2 is slow. Option 1 is viable but would need some time and effort. Meanwhile, option 3 has been discovered. That came in handy 🙂. Ignore for a second that the solution is hacky. I argue that it is actually quite ingenious. Plus, it's the quickest way to achieve my goal. Kudos to infuerno for discovering that loophole.

That solution works well for me particularly because I only display post titles on my blog's index page. By default, Disqus' comment threads are identified by the page URL in which they are loaded. Since I force readers to visit the post page, each post gets its own unique comment thread.

It's dirty, but hey, it works! 🤷‍♂️ I'll leave it until I can get a better solution.

Now go on and leave some comments!

I allowed Guest Commenting if you would like to remain anonymous. Though, pre-moderation is enforced by default for guest comments. In other words, guest comments would require my approval to go public.