chore: image shortcode
This commit is contained in:
parent
f5da3a1fae
commit
b413f9ab16
18 changed files with 107 additions and 58 deletions
20
.eleventy.js
20
.eleventy.js
|
@ -3,18 +3,17 @@ import tablerIcons from 'eleventy-plugin-tabler-icons'
|
|||
import pluginRss from '@11ty/eleventy-plugin-rss'
|
||||
import postGraph from '@rknightuk/eleventy-plugin-post-graph'
|
||||
import embedEverything from 'eleventy-plugin-embed-everything'
|
||||
import { eleventyImageTransformPlugin } from '@11ty/eleventy-img'
|
||||
|
||||
import markdownIt from 'markdown-it'
|
||||
import markdownItAnchor from 'markdown-it-anchor'
|
||||
import markdownItFootnote from 'markdown-it-footnote'
|
||||
import htmlmin from 'html-minifier-terser'
|
||||
import path from 'path';
|
||||
|
||||
import filters from './config/filters/index.js'
|
||||
import { slugifyString } from './config/utils/index.js'
|
||||
import { svgToJpeg } from './config/events/index.js'
|
||||
import { tagList, tagMap, postStats } from './config/collections/index.js'
|
||||
import { img } from './config/shortcodes/index.js'
|
||||
|
||||
import { execSync } from 'child_process'
|
||||
|
||||
|
@ -43,22 +42,6 @@ export default async function (eleventyConfig) {
|
|||
textColorDark: '#fff',
|
||||
})
|
||||
eleventyConfig.addPlugin(embedEverything);
|
||||
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
|
||||
extensions: 'html',
|
||||
formats: ['avif', 'webp', 'jpeg'],
|
||||
widths: [320, 570, 880, 1024, 1248],
|
||||
defaultAttributes: {
|
||||
loading: 'lazy',
|
||||
decoding: 'async',
|
||||
sizes: '90vw',
|
||||
},
|
||||
outputDir: './_site/assets/img/cache/',
|
||||
urlPath: '/assets/img/cache/',
|
||||
filenameFormat: (id, src, width, format) => {
|
||||
const { name } = path.parse(src);
|
||||
return `${name}-${width}w.${format}`;
|
||||
},
|
||||
});
|
||||
|
||||
// quiet build output
|
||||
eleventyConfig.setQuietMode(true)
|
||||
|
@ -117,6 +100,7 @@ export default async function (eleventyConfig) {
|
|||
eleventyConfig.addFilter('slugify', slugifyString)
|
||||
|
||||
// shortcodes
|
||||
eleventyConfig.addShortcode('image', img)
|
||||
eleventyConfig.addShortcode('appVersion', () => appVersion)
|
||||
|
||||
// transforms
|
||||
|
|
Reference in a new issue