fix: 404 + image optimization
This commit is contained in:
parent
5dc95273ee
commit
0c6518cb1f
4 changed files with 10 additions and 8 deletions
|
@ -35,6 +35,7 @@
|
|||
/assets/img/social-card.jpg /assets/img/ogi/default.jpg 301!
|
||||
/posts / 301!
|
||||
/posts/2024 / 301!
|
||||
/blog/digital-privacy-tools /posts/2021/digital-privacy-tools/ 301!
|
||||
/assets/img/social-preview/your-site-your-home-your-web- /assets/img/social-preview/your-site-your-home-your-web-preview.jpeg 301!
|
||||
/tags/chatgpt/ /tags/ai/ 301!
|
||||
|
||||
|
|
|
@ -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 });
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "7.6.0",
|
||||
"version": "7.6.1",
|
||||
"description": "The source for my personal site. Built using 11ty.",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
|
@ -32,7 +32,11 @@
|
|||
{%- capture loadingStrategy -%}
|
||||
{%- if loading -%}{{ loading }}{%- else -%}lazy{%- endif -%}
|
||||
{%- endcapture -%}
|
||||
{% image item.image, alt, '', loadingStrategy, 320 %}
|
||||
{% if shape == 'square' %}
|
||||
{% image item.image, alt, '', loadingStrategy, 320 %}
|
||||
{% else %}
|
||||
{% image item.image, alt, '', loadingStrategy, 200 %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
|
Reference in a new issue