From 81e08296faf9e1a637c4c169bdd7c36455aa80d7 Mon Sep 17 00:00:00 2001 From: MDLeom <2809763-curben@users.noreply.gitlab.com> Date: Sun, 8 Mar 2020 09:39:14 +0000 Subject: [PATCH] fix(image-embed): handle embedding external image - move to site script to make theme more generic --- {themes/chameleon/scripts => scripts}/image.js | 3 +++ 1 file changed, 3 insertions(+) rename {themes/chameleon/scripts => scripts}/image.js (94%) diff --git a/themes/chameleon/scripts/image.js b/scripts/image.js similarity index 94% rename from themes/chameleon/scripts/image.js rename to scripts/image.js index 4dc2403..84636c2 100644 --- a/themes/chameleon/scripts/image.js +++ b/scripts/image.js @@ -21,6 +21,9 @@ hexo.extend.filter.register('marked:renderer', (renderer) => { // See source/_redirects const link = '/img/' + // embed external image + if (!href.startsWith('20')) return `${alt}` + if (href.endsWith('.png') || href.endsWith('.jpg')) { modern = href.concat('?format=webp') } else if (href.endsWith('.webp')) {