feat: new post 21-09-2024
This commit is contained in:
22
.eleventy.js
22
.eleventy.js
@ -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',
|
||||
|
Reference in New Issue
Block a user