Skip to content

Jekyll Integration

Jekyll is a legend of an SSG, laying the foundation of the Jamstack ecosystem even before “Jamstack” became a term. Its developer friendliness and low barrier to entry still make it a strong contender in the more “modern” era, making it an obvious one to decide to support for JamComments.

These instructions assume you’ve already created a JamComments account as well as a site within that account. If you haven’t, learn more about that process on the Getting Started page.

Installation & Configuration

In your Jekyll site, install the plugin by running bundle add jekyll_jam_comments or by adding the following to your Gemfile:

gem "jekyll_jam_comments"

After doing so, set up the following environment variables for your site:

SyntaxDescription
JAM_COMMENTS_DOMAINThe domain for your site as configured in your account. Don’t include the protocol (“https”).
JAM_COMMENTS_API_KEYThe API generated in your account settings.
JAM_COMMENTS_ENVIRONMENTSetting this to development will cause “dummy” comments to be locally rendered, which is helpful for styling. By default, this will fall back to the value of JEKYLL_ENV.

If you’d like to set these values within your config.yml file, you may do so:

config.yml
jam_comments:
domain: JAM_COMMENTS_DOMAIN
api_key: JAM_COMMENTS_API_KEY
environment: 'production' or 'development' # optional

Usage

Place the {% jam_comments %} Liquid tag on the page you’d like comments to appear. Under the hood, the plugin uses the page.url context variable to determine the page path.

<div class="post">
<!-- content... -->
</div>
{% jam_comments %}

Overridding Copy in UI

The JamComments UI comes with its own set of basic copy for its components (submission confirmation, submit button text, etc.). Many of this copy can be overridden with the copy prop.

PropertyWhere It AppearsDefault
confirmation_messageIn the success banner after submitting a comment.”Comment successfully submitted!”
submit_buttonIn the comment submission button.”Submit”
name_placeholderIn the “name” input.(empty)
email_placeholderIn the “email” input.(empty)
comment_placeholderIn the comment textarea.”Write something in plain text or Markdown…”
write_tabIn the tab for composing a comment.”Write”
preview_tabIn the tab for previewing a comment.”Preview”
auth_buttonIn the link for signing in or registering.”Log In or Register”
log_out_buttonIn the link for logging out.”Log Out”

You can pass these values in the copy option:

config.yml
jam_comments:
domain: JAM_COMMENTS_DOMAIN
api_key: JAM_COMMENTS_API_KEY
copy:
comment_placeholder: "Write something"
submit_button: "Send it!",
name_placeholder: "Ur Mom",
email_placeholder: "[email protected]"

Contributions

The source for this plugin is open to contributions. If you have a bug fix or idea for improvement, leave a pull request or issue in the GitHub repository.