1.0.5 • Published 5 years ago
eleventy-plugin-wordcount v1.0.5
Eleventy
A collection of eleventy plugins
WordCount
This plugin creates a filter that takes a string, like 11ty content, then strips HTML tags, trims the lines and returns the word count.
- Install the NPM package in eleventy folder
npm install -S eleventy-plugin-wordcount- Create or modify your
.eleventy.jsand add the plugin
const { wordCount } = require("eleventy-plugin-wordcount");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(wordCount);
};- Use the plugin filter in your
liquidtemplates
<strong>Contains {{ content | wordCount }} words</strong>