2019-08-09 13:02:51 +00:00
|
|
|
'use strict'
|
|
|
|
/* global hexo */
|
|
|
|
|
2018-10-01 02:24:11 +00:00
|
|
|
/*
|
2019-05-23 07:16:02 +00:00
|
|
|
* Put {% cloudinary 'folder/filename.jpg' 'description' %} in your post.
|
|
|
|
* Change the username in data-src tag
|
|
|
|
* and cloud name in typing.js
|
2018-10-01 02:24:11 +00:00
|
|
|
* src is an animated svg generated from https://loading.io/
|
|
|
|
* More info:
|
|
|
|
* https://hexo.io/docs/tag-plugins
|
|
|
|
* https://hexo.io/api/tag
|
|
|
|
* https://cloudinary.com/documentation/responsive_images
|
|
|
|
*/
|
2019-05-23 07:16:02 +00:00
|
|
|
hexo.extend.tag.register('cloudinary', (args) => {
|
|
|
|
const fileName = args[0]
|
2019-07-10 11:47:17 +00:00
|
|
|
const alt = args[1] || ''
|
2019-05-23 07:16:02 +00:00
|
|
|
|
2019-06-29 09:25:32 +00:00
|
|
|
return '<a href="https://res.cloudinary.com/curben/' + fileName + '"><img class="cld-responsive" data-src="https://res.cloudinary.com/curben/image/upload/w_auto,f_auto,q_auto,c_scale/c_limit,w_600,h_400/' + fileName + '" src="/svg/loading.svg" alt="' + alt + '"></a>'
|
2018-10-25 09:03:38 +00:00
|
|
|
})
|