Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vitaliy-bobrov/metalsmith-commento
Commento (https://commento.io/) comments plugin for Metalsmith.
https://github.com/vitaliy-bobrov/metalsmith-commento
commento comments metalsmith metalsmith-plugin
Last synced: 8 days ago
JSON representation
Commento (https://commento.io/) comments plugin for Metalsmith.
- Host: GitHub
- URL: https://github.com/vitaliy-bobrov/metalsmith-commento
- Owner: vitaliy-bobrov
- License: mit
- Created: 2019-04-14T20:03:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-10T10:09:38.000Z (over 3 years ago)
- Last Synced: 2024-10-11T15:43:19.803Z (about 1 month ago)
- Topics: commento, comments, metalsmith, metalsmith-plugin
- Language: JavaScript
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# metalsmith-commento
[![npm version](https://badge.fury.io/js/metalsmith-commento.svg)](https://badge.fury.io/js/metalsmith-commento)
[![npm](https://img.shields.io/npm/dt/metalsmith-commento.svg)](https://github.com/vitaliy-bobrov/metalsmith-commento)A Metalsmith plugin that adds [Commento](https://commento.io/) commenting widget and counter scripts.
## Installation
$ npm install --save-dev metalsmith-commento
## Usage
Place `metalsmith-commento` plugin after html files generation, for example after `metalsmith-layouts`.
```js
const Metalsmith = require('metalsmith');
const commento = require('metalsmith-commento');Metalsmith(__dirname)
...
.use(commento({
cssOverride: 'https://my-blog.com/my-styles.css',
autoInit: false,
idRoot: 'comments-block',
counterSelector: '.comments-counter'
}));
```In your templates you need to add `
` for commenting widget. For comments counter add link to the post with `commento-counter` class name.Examples:
Page with comments template using handlebars:
```xml
Your page markup
{{#if comments }}
{{/if}}
```Page with counters template using handlebars:
```xml
Your page markup
To enable comments for page just add `comments: true` to page metadata.
Example:```yaml
---
title: Hello World
comments: true
---
```To enable comments counter for page just add `comments-counter: true` to page metadata.
Example:```yaml
---
title: Post
comments-counter: true
---
```## Options
For the detailed description of options look at the [Commento docs](https://docs.commento.io/configuration/frontend/).
### cssOverride
Type: StringDefault: null
Path to the commento CSS overrides.
### autoInit
Type: BooleanDefault: true
Whether commento should be initialized automatically after script load.
### idRoot
Type: StringDefault: 'commento'
CSS selector string used to find the element in a template to insert comments.
### counterSelector
Type: StringDefault: '.commento-counter'
CSS selector string used to find links in a template to insert comments counter.
#### CLI
You can also use the plugin with the Metalsmith CLI by adding a key to your `metalsmith.json` file:
```json
{
"plugins": {
"metalsmith-commento": {
"cssOverride": "https://my-blog.com/my-styles.css",
"autoInit": false,
"idRoot": "comments-block",
"counterSelector": ".comments-counter"
}
}
}
```## License
MIT