mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
1. Feature: random cover #10
2. Fix: valine lang not work 3. Fix: archives page site name not change when the language change 4. Fix: related posts url error
This commit is contained in:
13
scripts/random_cover.js
Normal file
13
scripts/random_cover.js
Normal file
@@ -0,0 +1,13 @@
|
||||
hexo.extend.helper.register('random_cover', function () {
|
||||
var cover;
|
||||
var num;
|
||||
if (!Array.isArray(hexo.theme.config.default_cover)) {
|
||||
cover = hexo.theme.config.default_cover
|
||||
return cover
|
||||
} else {
|
||||
num = Math.floor(Math.random() * (hexo.theme.config.default_cover.length));
|
||||
cover = hexo.theme.config.default_cover[num];
|
||||
return cover
|
||||
}
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user