Skip to content

Commit

Permalink
standardize image widths and sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
andyautida14 committed Oct 27, 2023
1 parent badad72 commit f4e0a29
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions eleventy.config.images.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ module.exports = eleventyConfig => {

// Eleventy Image shortcode
// https://www.11ty.dev/docs/plugins/image/
eleventyConfig.addAsyncShortcode("image", async function imageShortcode(src, alt, widths, sizes) {
eleventyConfig.addAsyncShortcode("image", async function imageShortcode(src, alt) {
// Full list of formats here: https://www.11ty.dev/docs/plugins/image/#output-formats
// Warning: Avif can be resource-intensive so take care!
let formats = ["avif", "webp", "auto"];
let file = relativeToInputPath(this.page.inputPath, src);
let metadata = await eleventyImage(file, {
widths: widths || [300, 600, "auto"],
widths: [316, 460, 768],
formats,
outputDir: path.join(eleventyConfig.dir.output, "img"), // Advanced usage note: `eleventyConfig.dir` works here because we’re using addPlugin.
});

// TODO loading=eager and fetchpriority=high
let imageAttributes = {
alt,
sizes: sizes || [300, 600],
sizes: "(max-width: 768px) 100vw, 768px",
loading: "lazy",
decoding: "async",
};
Expand Down

0 comments on commit f4e0a29

Please sign in to comment.