Skip to content

Bridgetown Integration

Bridgetown.rb is a modern spin-off of the Jekyll static site generator, with a sophisticated & growing breadth of features that make it a great choice for buidling a content platform.

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

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

gem "bridgetown_jam_comments"

After doing so, initialize the integration by adding the following to your config/initializers.rb file:

Bridgetown.configure do |config|
# The rest of your site's configuration...
init :bridgetown_jam_comments
end

Configuration Values

The following variables are supported by the itegration:

SyntaxDescription
domainThe domain for your site as configured in your account. Don’t include the protocol (“https”).
api_keyThe API generated in your account settings.
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 BRIDGETOWN_ENV.

There are a few different ways you can configure these.

Inside Your Initializer

Bridgetown.configure do |config|
# The rest of your site's configuration...
init :bridgetown_jam_comments
domain "your.domain.com"
api_key "123-api-key"
environment "production" # or "development" (optional)
end
end

Environment Variables

VariableSyntax
domainJAM_COMMENTS_DOMAIN
api_keyJAM_COMMENTS_API_KEY
environmentJAM_COMMENTS_ENVIRONMENT

In Your Config File

bridgetown.config.yml
bridgetown_jam_comments:
domain: "your.domain.com"
api_key: "123-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 context["page"]["relative_url"] to determine the page path, which will be used to associate your comment to a post.

<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:

bridgetown.config.yml
bridgetown_jam_comments:
domain: "your.domain.com"
api_key: "123-api-key"
environment: "production" # or 'development' (optional)
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.