build: 💚 Fixed output dir

This commit is contained in:
Keith Irwin 2023-10-18 13:14:48 -06:00
parent 0afa010da0
commit 4b962946c7
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
1 changed files with 5 additions and 4 deletions

View File

@ -14,7 +14,7 @@ const dirs ={
input: '_src',
includes: '_includes',
data: '_data',
output: '/var/www',
output: '_site',
}
module.exports = (eleventyConfig) => {
@ -132,7 +132,8 @@ module.exports = (eleventyConfig) => {
// Resize images
// https://www.11ty.dev/docs/plugins/image/#make-your-own-markup
eleventyConfig.addShortcode("image", async (src, alt) => {
eleventyConfig.addShortcode("image", async (src, alt='') => {
if (alt==='') alt = path.basename(src)
const metadata = await pluginImage(`./_src${src}`, {
widths: [...IMAGE_SIZES, 'auto'],
formats: ['auto', 'webp', 'avif'],
@ -145,9 +146,9 @@ module.exports = (eleventyConfig) => {
})
const lowsrc = metadata.webp[0]
const highsrc = metadata.webp[metadata.webp.length - 1]
return `<a href="${src}"><picture>\n${Object.values(metadata).map(imageFormat =>
return `<picture>\n${Object.values(metadata).map(imageFormat =>
`\t<source type="${imageFormat[0].sourceType}" srcset="${imageFormat.map(entry => entry.srcset).join(", ")}" sizes="${IMAGE_SIZES.reverse().reduce((str,size) =>
`(max-width:${size}px) ${size}px, ${str}`,'100vw')}">`).join("\n")}\n\t<img src="${lowsrc.url}" width="${highsrc.width}" height="${highsrc.height}" alt="${alt}" decoding="async">\n</picture></a>`
`(max-width:${size}px) ${size}px, ${str}`,'100vw')}">`).join("\n")}\n\t<img src="${lowsrc.url}" width="${highsrc.width}" height="${highsrc.height}" alt="${alt}" decoding="async">\n</picture>`
})
// Video shortcode