44
loading...
This website collects cookies to deliver better user experience
img
which then can be copied passthrough by 11ty. What I did was:src/img
src/img
I had to migrate image references in markdown files as well. Instead of using image syntax for markdown: 
I"m using nunjucks shortcode. For example by using this shortcode inside markdown:{% img "Path without extension", "Alt text", "Figcaption text" %}
config.addShortcode("img", (path, alt, figcaption) => {
return `<figure>
<a href="/img/${path}.webp" target="_blank" rel="noopener">
<img src="/img/${path}.webp" loading="lazy" alt="${alt}">
</a>
<figcaption>${figcaption}</figcaption>
</figure>`;
});
img
shortcode is defined and all images in all files will be affected by change in one place.()
around expression and use it inside replace as $1
. Super helpful!// find & replace example with regex capture groupslug: '(.\*)' // findpermalink: '$1/index.html' // replace by
44