-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hexojs/master' into add-api-section
- Loading branch information
Showing
886 changed files
with
7,495 additions
and
7,879 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* global hexo */ | ||
|
||
'use strict'; | ||
|
||
hexo.extend.filter.register('before_generate', async () => { | ||
const Data = hexo.model('Data'); | ||
for (const type of ['themes', 'plugins']) { | ||
const arr = []; | ||
Data.forEach(({_id, data}) => { | ||
if (_id.startsWith(type + '/')) { | ||
arr.push({ | ||
name: _id.replace(type + '/', ''), | ||
...data | ||
}); | ||
} | ||
}); | ||
if (Data.has(type)) { | ||
await Data.replaceById(type, { data: arr }); | ||
} else { | ||
await Data.insert({ | ||
_id: type, | ||
data: arr | ||
}); | ||
} | ||
} | ||
}, 0); |
Oops, something went wrong.