Ruby wrapper to get configured with the commenting engine, Komments
Add this line to your application's Gemfile:
gem 'komments'
And then execute:
bundle
Or install it yourself as:
gem install komments
Currently the main functionality of this library is to configure your api key so that your personalized site url can be generated.
To do this:
Komments.configure do |config|
config.api_key = 'API_KEY_GOES_HERE'
end
Would be the most straight forward way to go about this. If this were being used in a Rails project, I would recommend putting this in your config/initializers
directory.
Now that your credentials are out of the way, you'll be able to call:
Komments.website_url
This will provide your site's url to Komments. Add that to a script
tag in your template and you will be good to go.
<script async="async" src=<%= Komments.website_url %>></script>
That will end up looking this this:
<script async="async" src="//komments.net/embed/{API_KEY_GOES_HERE}"></script>
If you happen to be integrating Komments into your Rails application, you're covered as well.
When a Rails app is detected, you'll gain access to the komments_script_tag
helper.
<%= komments_script_tag %>
Which will render out to:
<script async="async" src="//komments.net/embed/{API_KEY_GOES_HERE}"></script>
And if you don't want the script to be loaded asynchronously...
<%= komments_script_tag(false) %>
Which will render out to:
<script defer="defer" src="//komments.net/embed/{API_KEY_GOES_HERE}"></script>
- Fork it ( https://github.com/[my-github-username]/komments/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request