From 0c6518cb1ffe421b82123c5e7605d35bd782d1f2 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt <coryd@hey.com> Date: Thu, 7 Mar 2024 11:41:51 -0800 Subject: [PATCH] fix: 404 + image optimization --- _redirects | 1 + config/shortcodes/index.js | 9 +++------ package.json | 2 +- src/_includes/partials/now/media-grid.liquid | 6 +++++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/_redirects b/_redirects index 0952c0a6..b674743c 100644 --- a/_redirects +++ b/_redirects @@ -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! diff --git a/config/shortcodes/index.js b/config/shortcodes/index.js index aea54b29..b92f7a16 100644 --- a/config/shortcodes/index.js +++ b/config/shortcodes/index.js @@ -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 }); }; \ No newline at end of file diff --git a/package.json b/package.json index 8a7f5ffe..65060254 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/_includes/partials/now/media-grid.liquid b/src/_includes/partials/now/media-grid.liquid index 95cb498a..64db184d 100644 --- a/src/_includes/partials/now/media-grid.liquid +++ b/src/_includes/partials/now/media-grid.liquid @@ -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 %}