mpalmer/jekyll-static-comments

Example YAML file in _comments?

Closed this issue · 8 comments

Thanks for sharing this plugin, this looks like a brilliant solution for Jekyll comments. I'm unclear how you go from the email to the yaml database holding the comments data, is that manual? Can you provide an example file containing a comment such as you would have in _comments/ so I can get a better idea how the data should be laid out?

(Hoping to write a little wrapper that can extract my disqus based comments and put them in the yaml format you describe here).

Cheers,
Carl

@cboettig I am also working on a way to import Disqus comments for use with jekyll-static-comments
Perhaps this would be of intrest to you?

Here is a sample YAML comment: https://gist.github.com/IQAndreas/5384357

Note that the return_url parameter only shows up in comments generated by my fork, and not in mpalmer's version.

@pathawks Thanks, exactly what I was thinking about. I'll give it a whirl.

@IQAndreas thanks for the example. -- I'm thinking something along the
lines of @wereHamster's version to avoid the PHP requirements (I'm deployed
via gh-pages), and just want to see if I've got this straight: the example
YAML file you show is generated from the email by the ruby script
automatically?
https://github.com/IQAndreas/iqandreas.github.com/blob/source/plugins/static_comments.rb
or
is the ruby plugin just parsing that file? Bit confused about the workflow
here...

On Sun, Apr 14, 2013 at 2:47 PM, Andreas Renberg
notifications@github.comwrote:

Here is a sample YAML comment: https://gist.github.com/IQAndreas/5384357

Note that the return_url parameter only shows up in comments generated by my
fork https://github.com/IQAndreas/jekyll-static-comments, and not in
mpalmer's version.


Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-16360273
.

Carl Boettiger
UC Santa Cruz
http://www.carlboettiger.info/

I'm thinking something along the lines of @wereHamster's version to avoid the PHP requirements

I can't find the repository you are referring to. Is his fork stored under a different name? Or is his project independent from this one?

just want to see if I've got this straight: the example YAML file you show is generated from the email by the ruby script automatically?

It only parses the file.

Bit confused about the workflow here...

I'll outline mpalmer's version for ease:

  1. User writes the blog post in a <form> element on the static Jekyll blog
  2. The form's data gets sent to a PHP script (commentsubmit.php) and converted to YAML (formatted like the example)
  3. That YAML text gets placed in the body of an email and sent to your inbox
  4. You copy the body of the email and paste the data into a text file in a _comments directory
  5. When you rake generate your Jekyll site, the static_comments.rb script will parse those comments from the YAML data and "place" them where they belong

So, the PHP script generates the YAML; the Ruby script parses it into HTML.

If you want to generate your own comments, you only need the following fields for each comment:
https://gist.github.com/IQAndreas/5384749

My code is not publicly available, but basically works like this:

  1. The plugin generates a unique mailto: link for each blog post.
  2. User wishing to comment sends an email to that address.
  3. Upon receiving the emails, the blog operator drops the raw emails into the _comments/ subdirectory.
  4. Jekyll plugin parses the emails (using ruby 'mail' gem ..) and uses the mail body as comment.

The only differences between my and @IQAndreas' approach is:

  • Use email instead of html form to submit comments
  • Stores comments as raw emails instead of YAML.

Thanks both for the outline of each workflow, this clarifies my confusion
about storing YAML vs email contents in _comments/ directory. I think I
have a solid enough understanding to deploy static comments on my blog.
Thanks again for the help.

On Mon, Apr 15, 2013 at 2:13 AM, Tomas Carnecky notifications@github.comwrote:

My code is not publicly available, but basically works like this:

  1. The plugin generates a unique mailto: link for each blog post.
  2. User wishing to comment sends an email to that address.
  3. Upon receiving the emails, the blog operator drops the raw emails
    into the _comments/ subdirectory.
  4. Jekyll plugin parses the emails (using ruby 'mail' gem ..) and uses
    the mail body as comment.

The only differences between my and @IQAndreashttps://github.com/IQAndreas'
approach is:

  • Use email instead of html form to submit comments
  • Stores comments as raw emails instead of YAML.


Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-16374467
.

Carl Boettiger
UC Santa Cruz
http://www.carlboettiger.info/

I'm trying out with the plugin part alone.
I followed the YAML example and changed the post_id accordingly (should match with one particular {{ post.id }}). To be precise, I wrote post_id: /blog/jekyll where the post index.html is located in the jekyll folder.
I named it testing.yaml under /_comments
But I found that {{ page.comment_count }} on the post webpage, or {{ post.comment_count }} in looping through {{ site.posts }} is 0. No luck on showing any comment. I guess the connection between the .yaml file and the .rb script is somehow broken (not identified? some steps missing? dependencies?).
I use Jekyll 1.2.1 and generate my site with $ jekyll serve. I never used $ rake generate before. Could it be the problem?
I tried to understand the script and find out the problem, but as a Ruby newbie I stuck with StaticComments.read_comments(). Any idea?

I use Jekyll 1.2.1

Ah, there is the problem. :) There is a known problem with Jekyll 1.1.0 and above: #13 Although it should have given you an error message when you tried to run jekyll serve, I'm not sure why it didn't.

You can either make the tiny change necessary to fix it yourself, or you can use my fork of the script: https://github.com/IQAndreas/jekyll-static-comments

It also adds a few features, such as:

  • Comments use a "frontmatter header" and a "content" area instead (but the old style of comments will still be parsed properly) Exmple: https://gist.github.com/IQAndreas/6806901/raw/1fbc538391d2fc15347e68c63ceccb65063f5306/sample-comment.md
  • Automatically parsing the comment format based on the extension -- if it ends with .md, Markdown is supported, if it is named .txt everything (including HTML will just be treated as plaintext), and if it is .html or any other extension, it allows for most html.
  • Comments work for both pages and posts (the original version only works for posts).
  • Comments can be "prevented" from showing up with the attribute published: false.

I still haven't updated the documentation with my features, and I'm still tweaking it a bit, but at the moment, it should be completely functional, and reverse-compatible with comments generated in previous versions of the script.