Install eleventy-plugin-embed-everything

This commit is contained in:
Helen Chong 2024-04-15 18:21:10 +08:00
parent 910d67cc38
commit 1d3e5c4019
3 changed files with 19 additions and 16 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -4,6 +4,7 @@ const pluginRss = require("@11ty/eleventy-plugin-rss");
const metagen = require('eleventy-plugin-metagen'); const metagen = require('eleventy-plugin-metagen');
const pluginTOC = require('eleventy-plugin-nesting-toc'); const pluginTOC = require('eleventy-plugin-nesting-toc');
const emojiReadTime = require("@11tyrocks/eleventy-plugin-emoji-readtime"); const emojiReadTime = require("@11tyrocks/eleventy-plugin-emoji-readtime");
const embedEverything = require("eleventy-plugin-embed-everything");
// Configure slug filter // Configure slug filter
const slugify = require("slugify"); const slugify = require("slugify");
@ -18,28 +19,13 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addWatchTarget("./src/assets/"); eleventyConfig.addWatchTarget("./src/assets/");
eleventyConfig.addPassthroughCopy({ "./src/assets/feed/": "/" }); eleventyConfig.addPassthroughCopy({ "./src/assets/feed/": "/" });
// Filter: Format dates
const dateOptions = {
year: 'numeric',
month: 'long',
day: 'numeric',
};
const dateTimeLocale = new Intl.DateTimeFormat("en-GB", dateOptions);
eleventyConfig.addFilter("niceDate", function(date) {
return dateTimeLocale.format(date);
});
// Filter: Limit
eleventyConfig.addFilter("limit", function(array, limit) {
return array.slice(0, limit);
});
// Installed Plug-ins // Installed Plug-ins
eleventyConfig.addPlugin(EleventyRenderPlugin); eleventyConfig.addPlugin(EleventyRenderPlugin);
eleventyConfig.addPlugin(pluginRss); eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(metagen); eleventyConfig.addPlugin(metagen);
eleventyConfig.addPlugin(pluginTOC, { tags: ['h2', 'h3', 'h4', 'h5'] }); eleventyConfig.addPlugin(pluginTOC, { tags: ['h2', 'h3', 'h4', 'h5'] });
eleventyConfig.addPlugin(emojiReadTime); eleventyConfig.addPlugin(emojiReadTime);
eleventyConfig.addPlugin(embedEverything);
// Configure slug filter // Configure slug filter
eleventyConfig.addFilter("slug", (str) => { eleventyConfig.addFilter("slug", (str) => {
@ -103,6 +89,22 @@ module.exports = function (eleventyConfig) {
/* This is the part that tells 11ty to swap to our custom config */ /* This is the part that tells 11ty to swap to our custom config */
eleventyConfig.setLibrary("md", markdownLibrary); eleventyConfig.setLibrary("md", markdownLibrary);
// Filter: Format dates
const dateOptions = {
year: 'numeric',
month: 'long',
day: 'numeric',
};
const dateTimeLocale = new Intl.DateTimeFormat("en-GB", dateOptions);
eleventyConfig.addFilter("niceDate", function(date) {
return dateTimeLocale.format(date);
});
// Filter: Limit
eleventyConfig.addFilter("limit", function(array, limit) {
return array.slice(0, limit);
});
return { return {
dir: { dir: {
input: "src" input: "src"

View File

@ -15,6 +15,7 @@
"@11ty/eleventy": "^2.0.1", "@11ty/eleventy": "^2.0.1",
"@11ty/eleventy-plugin-rss": "^1.2.0", "@11ty/eleventy-plugin-rss": "^1.2.0",
"@11tyrocks/eleventy-plugin-emoji-readtime": "^1.0.1", "@11tyrocks/eleventy-plugin-emoji-readtime": "^1.0.1",
"eleventy-plugin-embed-everything": "^1.18.2",
"eleventy-plugin-metagen": "^1.8.3", "eleventy-plugin-metagen": "^1.8.3",
"eleventy-plugin-nesting-toc": "^1.3.0", "eleventy-plugin-nesting-toc": "^1.3.0",
"install": "^0.13.0", "install": "^0.13.0",