mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
improvement: 網站資料顯示,但標籤和分類為0時,數量顯示為 0,而不是隱藏 improvement: subtitle 代碼優化, 1.當source設為false,同時sub也沒有配置,將會讀取hexo配置文件的 subtitle,2.無須使用轉義字符 improvement: 禁止ios點擊搜索框,頁面放大的問題
35 lines
827 B
JavaScript
35 lines
827 B
JavaScript
/**
|
|
* Butterfly
|
|
* galleryGroup and allery
|
|
*/
|
|
|
|
'use strict'
|
|
|
|
const urlFor = require('hexo-util').url_for.bind(hexo)
|
|
|
|
function gallery (args, content) {
|
|
return `<div class="justified-gallery">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
|
|
</div>`
|
|
}
|
|
|
|
function galleryGroup (args) {
|
|
const name = args[0]
|
|
const desrc = args[1]
|
|
const url = urlFor(args[2])
|
|
const img = urlFor(args[3])
|
|
|
|
return `
|
|
<figure class="gallery-group not-lightbox">
|
|
<img class="gallery-group-img" src='${img}' alt="Group Image Gallery">
|
|
<figcaption>
|
|
<div class="gallery-group-name">${name}</div>
|
|
<p>${desrc}</p>
|
|
<a href='${url}'></a>
|
|
</figcaption>
|
|
</figure>
|
|
`
|
|
}
|
|
|
|
hexo.extend.tag.register('gallery', gallery, { ends: true })
|
|
hexo.extend.tag.register('galleryGroup', galleryGroup)
|