feat: new post 21-09-2024
All checks were successful
/ build-node (push) Successful in 56s
/ publish (push) Successful in 28s

This commit is contained in:
2024-09-22 01:27:39 +10:00
parent f5c891910e
commit 20a993d258
7 changed files with 180 additions and 11 deletions

View File

@ -1,28 +1,35 @@
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");
// Import prior to `module.exports` within `.eleventy.js`
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);
@ -38,7 +45,7 @@ module.exports = function(eleventyConfig) {
eleventyConfig.setTemplateFormats("html,njk,md");
eleventyConfig.addCollection('posts', function(collectionApi) {
return collectionApi.getFilteredByGlob('src/blog/posts/**/*.md')
return collectionApi.getFilteredByGlob('src/blog/posts/**/*.md');
});
eleventyConfig.addPlugin(blogTools);
@ -46,7 +53,6 @@ module.exports = function(eleventyConfig) {
return {
passthroughFileCopy: true,
dir: {
input: 'src',
includes: '_includes',