1.0.3 • Published 7 months ago
eleventy-first-image-plugin v1.0.3
Eleventy First Image Plugin
A simple Eleventy plugin to extract the first image from a post.
Installation
Install the plugin via npm:
npm install eleventy-first-image-plugin
Usage
Add the plugin to your .eleventy.js
configuration file:
import firstImagePlugin from "eleventy-first-image-plugin";
export default function (eleventyConfig) {
eleventyConfig.addPlugin(firstImagePlugin);
}
Then use the {% first_image %}
shortcode in your templates to extract the first image:
{% first_image post %}
This will return the first image from the post's content.