feat: 💄 apply sizes attribute to image elements globally

This commit is contained in:
Sebin Nyshkim 2024-10-22 12:52:25 +02:00
parent 796619d22b
commit 9dbd68c048
2 changed files with 3 additions and 2 deletions

View file

@ -76,7 +76,8 @@ export default async function (eleventyConfig) {
outputDir: './public/img/',
defaultAttributes: {
loading: 'lazy',
decoding: 'async'
decoding: 'async',
sizes: '(min-width: 1280px) 960px, (min-width: 1024px) 768px, (min-width: 640px) 640px, 480px'
}
});
eleventyConfig.addPlugin(feedPlugin, {

View file

@ -20,7 +20,7 @@ pagination:
</div>
{% if post.data.image and post.data.image.src != '' %}
<img src="{{ post.data.image.src }}" alt="{{ post.data.image.alt }}" sizes="(min-width: 1280px) 960px, (min-width: 1024px) 768px, (min-width: 640px) 640px, 480px">
<img src="{{ post.data.image.src }}" alt="{{ post.data.image.alt }}">
{% endif %}
<p>{{ post.data.description }}</p>