diff --git a/.eleventy.js b/.eleventy.js
index ffdd4795..de27046c 100644
--- a/.eleventy.js
+++ b/.eleventy.js
@@ -3,6 +3,8 @@ const heroIcons = require('eleventy-plugin-heroicons')
const pluginUnfurl = require('eleventy-plugin-unfurl')
const pluginFilesMinifier = require('@sherby/eleventy-plugin-files-minifier')
const schema = require('@quasibit/eleventy-plugin-schema')
+const { eleventyImagePlugin } = require('@11ty/eleventy-img')
+const Image = require('@11ty/eleventy-img')
const markdownIt = require('markdown-it')
const markdownItAnchor = require('markdown-it-anchor')
const markdownItFootnote = require('markdown-it-footnote')
@@ -21,6 +23,7 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(pluginUnfurl)
eleventyConfig.addPlugin(pluginFilesMinifier)
eleventyConfig.addPlugin(schema)
+ eleventyConfig.addPlugin(eleventyImagePlugin)
// tailwind watches
eleventyConfig.addWatchTarget('./tailwind.config.js')
@@ -89,9 +92,24 @@ module.exports = function (eleventyConfig) {
return md.render(content)
})
- // asset_img shortcode
- eleventyConfig.addLiquidShortcode('asset_img', (filename, alt) => {
- return ``
+ // image shortcode
+ eleventyConfig.addShortcode('image', async function (src, alt, css, sizes, loading) {
+ let metadata = await Image(src, {
+ widths: [75, 150, 300, 600],
+ formats: ['webp'],
+ urlPath: '/assets/img/cache/',
+ outputDir: './_site/assets/img/cache/',
+ })
+
+ let imageAttributes = {
+ class: css,
+ alt,
+ sizes,
+ loading: loading || 'lazy',
+ decoding: 'async',
+ }
+
+ return Image.generateHTML(metadata, imageAttributes)
})
return {
diff --git a/config/mediaFilters.js b/config/mediaFilters.js
index 25d8b984..38fd9c37 100644
--- a/config/mediaFilters.js
+++ b/config/mediaFilters.js
@@ -2,7 +2,7 @@ const ALBUM_DENYLIST = ['no-love-deep-web', 'unremittance']
module.exports = {
artist: (media) =>
- `https://cdn.coryd.dev/artists/min/${media.replace(/\s+/g, '-').toLowerCase()}.webp`,
+ `https://cdn.coryd.dev/artists/${media.replace(/\s+/g, '-').toLowerCase()}.jpg`,
album: (media) => {
return !ALBUM_DENYLIST.includes(media.name.replace(/\s+/g, '-').toLowerCase())
? media.image[media.image.length - 1]['#text'].replace(
@@ -11,8 +11,7 @@ module.exports = {
)
: `https://cdn.coryd.dev/albums/${media.name.replace(/\s+/g, '-').toLowerCase()}.jpg`
},
- tv: (episode) =>
- `https://cdn.coryd.dev/tv/min/${episode.replace(/\s+/g, '-').toLowerCase()}.webp`,
+ tv: (episode) => `https://cdn.coryd.dev/tv/${episode.replace(/\s+/g, '-').toLowerCase()}.jpg`,
movie: (url, host, cdn) => {
return url.replace(host, cdn).replace('600', '200').replace('900', '300')
},
diff --git a/src/_includes/now.liquid b/src/_includes/now.liquid
index cb0f0c5f..215d3bec 100644
--- a/src/_includes/now.liquid
+++ b/src/_includes/now.liquid
@@ -55,13 +55,9 @@ layout: main
{{ artist.playcount }} plays
-
+ {%- capture artistImg %}{{ artist.name | artist }}{% endcapture -%}
+ {%- capture artistName %}{{ artist.name | escape }}{% endcapture -%}
+ {% image artistImg, artistName, 'rounded-lg', '225px', 'eager' %}
{% endfor %}
@@ -84,14 +80,9 @@ layout: main
{{ album.artist.name }}
-
+ {%- capture albumImg %}{{ album | album }}{% endcapture -%}
+ {%- capture albumName %}{{ album.name | escape }}{% endcapture -%}
+ {% image albumImg, albumName, 'rounded-lg', '225px' %}
{% endfor %}
@@ -143,14 +134,9 @@ layout: main