mirror of
https://github.com/Fechin/reference.git
synced 2026-11-21 05:24:10 +03:00
Generate list.md
This commit is contained in:
1 parent
eb387ac3c3
commit
d3c2027007
1 file changed
+20
@@ -49,6 +49,26 @@ hexo.extend.generator.register('json', function (locals) {
|
||||
return {path: searchName, data: json};
|
||||
});
|
||||
|
||||
|
||||
hexo.extend.generator.register('list', function (locals) {
|
||||
const themeConfig = hexo.theme.config;
|
||||
let content = "";
|
||||
|
||||
themeConfig.index_categories.forEach(function (category) {
|
||||
content += `<details>\n<summary>${category}</summary>\n\n`;
|
||||
locals.categories.findOne({name: category}).posts.sort('-date').map(function (post) {
|
||||
content += `- [${post.title}](https://quickref.me/${post.path}): ${post.intro.trim()}\n`;
|
||||
})
|
||||
content += `\n</details>\n\n`;
|
||||
});
|
||||
|
||||
return {
|
||||
path: 'list.md',
|
||||
data: content
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
function svgIcon(name) {
|
||||
// Check file exists
|
||||
let svgPath = path.resolve("./", "source/assets/icon/", `${name}.svg`);
|
||||
|
||||
Reference in new issue
Block a user