We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 80dafe2 commit b6ebbcaCopy full SHA for b6ebbca
lib/hexo/index.ts
@@ -386,9 +386,15 @@ class Hexo extends EventEmitter {
386
return db.model('Page').find(query);
387
});
388
389
- locals.set('categories', () => db.model('Category'));
+ locals.set('categories', () => {
390
+ // Ignore categories with zero posts
391
+ return db.model('Category').filter(category => category.length);
392
+ });
393
- locals.set('tags', () => db.model('Tag'));
394
+ locals.set('tags', () => {
395
+ // Ignore tags with zero posts
396
+ return db.model('Tag').filter(tag => tag.length);
397
398
399
locals.set('data', () => {
400
const obj = {};
0 commit comments