TypeScript泛型

This commit is contained in:
结发受长生
2019-07-14 17:06:52 +08:00
parent 2d4a67120d
commit 95b2d33639
4 changed files with 207 additions and 5 deletions
+2 -2
View File
@@ -11,9 +11,9 @@ const searchTmplSrc = path.join(__dirname, '../templates/articles.xml')
hexo.extend.generator.register('xml', function(locals){
const searchTmpl = nunjucks.compile(fs.readFileSync(searchTmplSrc, 'utf8'), env)
const posts = locals.posts.sort('-date');
const posts = locals.posts.sort('-date').toArray().slice(0, 10)
const xmlData = searchTmpl.render({
posts: posts,
posts,
root: this.config.root
})
return {