eleventy-homepage/.eleventy.js

64 lines
2.0 KiB
JavaScript

// Add Syntax Highlighting plugin
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
// Add Inclusive Language plugin
// const inclusiveLangPlugin = require("@11ty/eleventy-plugin-inclusive-language");
// Add Naviagation plugin
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
// Add read time
const emojiReadTime = require("@11tyrocks/eleventy-plugin-emoji-readtime");
// make external links safer
const safeLinks = require('@sardine/eleventy-plugin-external-links');
// add a read progress bar to the page
const readerBar = require('eleventy-plugin-reader-bar');
// toc
const markdownIt = require('markdown-it');
const markdownItAnchor = require('markdown-it-anchor');
const pluginTOC = require('eleventy-plugin-toc')
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight); // syntax highlighting
// eleventyConfig.addPlugin(inclusiveLangPlugin); // inclusive language
eleventyConfig.addPlugin(eleventyNavigationPlugin); // navigation
eleventyConfig.addPlugin(emojiReadTime, {
emoji: "💠"
}); // read emojiReadTime
eleventyConfig.addPlugin(safeLinks); // safeLinks plugin
eleventyConfig.addPlugin(readerBar); // progress bar
eleventyConfig.addPlugin(pluginTOC, {
tags: ['h1', 'h2', 'h3', 'h4', 'h5'],
wrapper: 'div',
ul: true
}) // Table of Contents
// toc
eleventyConfig.setLibrary(
'md',
markdownIt().use(markdownItAnchor)
)
// add stylesheet
eleventyConfig.addPassthroughCopy("_src/style.css");
// add _media folder
eleventyConfig.addPassthroughCopy("_src/_media");
// add robots.txt
eleventyConfig.addPassthroughCopy({ '_src/robots.txt': '/robots.txt' });
// shortcodes
eleventyConfig.addShortcode("year", () => {
`${new Date().getFullYear()}`
});
// other settings
return {
markdownTemplateEngine: 'njk',
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
dir: {
input: "_src",
output: "_site"
},
passthroughFileCopy: true
};
};