mirror of https://gitlab.com/curben/blog
docs(cloudinary): set username as a variable
This commit is contained in:
parent
a15d53f6f9
commit
bb5b0fdd39
|
@ -3,20 +3,19 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Put {% cloudinary 'folder/filename.jpg' 'description' %} in your post.
|
* Put {% cloudinary 'folder/filename.jpg' 'description' %} in your post.
|
||||||
* Change the username in data-src tag
|
* Change the username in 'user' variable
|
||||||
* and cloud name in typing.js
|
|
||||||
* More info:
|
* More info:
|
||||||
* https://hexo.io/docs/tag-plugins
|
* https://cloudinary.com/blog/responsive_images_with_srcset_sizes_and_cloudinary
|
||||||
* https://hexo.io/api/tag
|
|
||||||
* https://cloudinary.com/documentation/responsive_images
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
hexo.extend.tag.register('cloudinary', (args) => {
|
hexo.extend.tag.register('cloudinary', (args) => {
|
||||||
|
const user = 'curben'
|
||||||
const fileName = args[0]
|
const fileName = args[0]
|
||||||
const alt = args[1] || ''
|
const alt = args[1] || ''
|
||||||
let modern = ''
|
let modern = ''
|
||||||
let legacy = ''
|
let legacy = ''
|
||||||
const cloudinary = 'https://res.cloudinary.com/curben/image/upload/w_auto,f_auto,q_auto,c_scale/c_limit,'
|
const cloudinary = 'https://res.cloudinary.com/' + user +
|
||||||
|
'/image/upload/w_auto,f_auto,q_auto,c_scale/c_limit,'
|
||||||
|
|
||||||
if (fileName.endsWith('.png')) {
|
if (fileName.endsWith('.png')) {
|
||||||
modern = fileName.replace(/\.png$/, '.webp')
|
modern = fileName.replace(/\.png$/, '.webp')
|
||||||
|
|
Loading…
Reference in New Issue