fix: 404 + image optimization

This commit is contained in:
Cory Dransfeldt 2024-03-07 11:41:51 -08:00
parent 5dc95273ee
commit 0c6518cb1f
No known key found for this signature in database
4 changed files with 10 additions and 8 deletions

View file

@ -20,7 +20,7 @@ export const img = async (
sizes = '90vw',
formats = ['avif', 'webp', 'jpeg']
) => {
const widths = [320, 570, 880, 1024, 1248].filter(width => width <= maxWidth);
const widths = [200, 320, 570, 880, 1024, 1248].filter(width => width <= maxWidth);
const metadata = await Image(src, {
widths: [...widths],
formats: [...formats],
@ -45,7 +45,7 @@ export const img = async (
})
.join('\n');
const imgageAttributes = stringifyAttributes({
const imageAttributes = stringifyAttributes({
src: lowsrc.url,
width: lowsrc.width,
height: lowsrc.height,
@ -55,10 +55,7 @@ export const img = async (
decoding: 'async',
});
const imageElement = `<picture>
${imageSources}
<img ${imgageAttributes} />
</picture>`;
const imageElement = `<picture>${imageSources}<img ${imageAttributes} /></picture>`;
return htmlmin.minify(imageElement, { collapseWhitespace: true });
};