From 7436391bc6a76a00469662ee4657c6045bedc8ba Mon Sep 17 00:00:00 2001 From: curben <2809763-curben@users.noreply.gitlab.com> Date: Sun, 25 Aug 2019 17:15:44 +0930 Subject: [PATCH] fix(cloudinary): include more sizes --- scripts/cloudinary.js | 58 +++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/scripts/cloudinary.js b/scripts/cloudinary.js index 771949c..63fc389 100644 --- a/scripts/cloudinary.js +++ b/scripts/cloudinary.js @@ -11,11 +11,13 @@ * https://hexo.io/api/tag * https://cloudinary.com/documentation/responsive_images */ + hexo.extend.tag.register('cloudinary', (args) => { const fileName = args[0] const alt = args[1] || '' let modern = '' let legacy = '' + const cloudinary = 'https://res.cloudinary.com/curben/image/upload/w_auto,f_auto,q_auto,c_scale/c_limit,' if (fileName.endsWith('.png')) { modern = fileName.replace(/\.png$/, '.webp') @@ -29,33 +31,51 @@ hexo.extend.tag.register('cloudinary', (args) => { return ` - + ${alt} ` } else { return ` - - ${alt} - ` + ` } })