comprofix.com/.eleventy.js
Matthew McKinnon 20a993d258
All checks were successful
/ build-node (push) Successful in 56s
/ publish (push) Successful in 28s
feat: new post 21-09-2024
2024-09-22 01:27:39 +10:00

63 lines
1.9 KiB
JavaScript

const blogTools = require("eleventy-plugin-blog-tools");
const markdownIt = require("markdown-it");
const markdownItAttrs = require("markdown-it-attrs");
const markdownItAnchor = require("markdown-it-anchor");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const { DateTime } = require("luxon");
module.exports = function(eleventyConfig) {
const mdOptions = {
html: true,
breaks: true,
linkify: true,
};
const markdownLib = markdownIt(mdOptions)
.use(markdownItAttrs)
.use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.linkInsideHeader({
// Change the symbol to a link icon, e.g., "🔗"
symbol: '🔗', // Change this to whatever symbol you want
class: 'anchor-link', // You can style this class with CSS
ariaHidden: false,
tabIndex: -1,
before: '', // Leave empty to not add anything before the icon
})
})
.disable("code");
eleventyConfig.addFilter("postDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toLocaleString(DateTime.DATE_MED);
});
eleventyConfig.setLibrary("md", markdownLib);
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addPassthroughCopy('./src/css');
eleventyConfig.addPassthroughCopy('./src/assets/');
eleventyConfig.addPassthroughCopy('./src/js/');
eleventyConfig.addWatchTarget('./src/css');
eleventyConfig.addWatchTarget('./src/js');
eleventyConfig.addWatchTarget('./src/assets/');
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.setTemplateFormats("html,njk,md");
eleventyConfig.addCollection('posts', function(collectionApi) {
return collectionApi.getFilteredByGlob('src/blog/posts/**/*.md');
});
eleventyConfig.addPlugin(blogTools);
eleventyConfig.addPlugin(syntaxHighlight);
return {
passthroughFileCopy: true,
dir: {
input: 'src',
includes: '_includes',
output: "_site"
}
};
}