Skip to content

Commit 4016d17

Browse files
committed
Extend models/category from ContentModelEntryNode
1 parent 31db389 commit 4016d17

File tree

5 files changed

+372
-322
lines changed

5 files changed

+372
-322
lines changed

src/compiler/contentModel/matchers.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ module.exports = function createMatchers(settings) {
2828

2929
collection: fsNode => {},
3030

31-
category: fsNode => {},
31+
category: (fsNode) => {
32+
fsNode.children?.find(childNode => {
33+
const containsPosts = matchers.post(childNode)
34+
if (settings.level > 3) {
35+
return containsPosts
36+
}
37+
const containsSubCategories = matchers.category(childNode, settings.level)
38+
return containsSubCategories || containsPosts
39+
})
40+
},
3241

3342
postIndexFile: fsNode => {
3443
const indexFileNameOptions = [settings.entryAlias, 'post', 'index'].filter(Boolean)

0 commit comments

Comments
 (0)