|
@@ -170,33 +170,30 @@ module.exports = {
|
|
|
matchingTemplate.dir
|
|
matchingTemplate.dir
|
|
|
}/${matchingTemplate.name}`
|
|
}/${matchingTemplate.name}`
|
|
|
);
|
|
);
|
|
|
- const isIndex = currentItem.tags.includes("index");
|
|
|
|
|
- const dirPath = currentItem.dir.split("/");
|
|
|
|
|
- const dir = dirPath
|
|
|
|
|
- .slice(1, dirPath.length - (isIndex ? 1 : 0))
|
|
|
|
|
- .join("/");
|
|
|
|
|
const entries = state
|
|
const entries = state
|
|
|
.selectByTag("content")
|
|
.selectByTag("content")
|
|
|
.selectByTag("markdown")
|
|
.selectByTag("markdown")
|
|
|
- .matchingAllTags(dirPath)
|
|
|
|
|
- .not(state.selectByTag("index"));
|
|
|
|
|
|
|
+ .matchingAllTags(currentItem.dirPath)
|
|
|
|
|
+ .not(state.selectByTag("index"))
|
|
|
|
|
+ .selectMany(item => item.depth <= currentItem.depth);
|
|
|
const sections = state
|
|
const sections = state
|
|
|
- .matchingAllTags(dirPath)
|
|
|
|
|
|
|
+ .matchingAllTags(currentItem.dirPath)
|
|
|
.selectByTag("index")
|
|
.selectByTag("index")
|
|
|
- .not([currentItem]);
|
|
|
|
|
|
|
+ .not([currentItem])
|
|
|
|
|
+ .selectMany(item => item.depth <= currentItem.depth + 1);
|
|
|
|
|
+ const isIndex = currentItem.tags.includes("index");
|
|
|
return {
|
|
return {
|
|
|
meta: {
|
|
meta: {
|
|
|
title: currentItem.niceName,
|
|
title: currentItem.niceName,
|
|
|
- dir: dir,
|
|
|
|
|
- dirPath: [...dirPath.slice(1), currentItem.name],
|
|
|
|
|
name: currentItem.name,
|
|
name: currentItem.name,
|
|
|
now: new Date().toLocaleString(),
|
|
now: new Date().toLocaleString(),
|
|
|
- context: dirPath[1],
|
|
|
|
|
|
|
+ context: currentItem.dirPath[1],
|
|
|
isIndex: isIndex,
|
|
isIndex: isIndex,
|
|
|
svgs: toNameContentObject(state.selectByTag("svgs")),
|
|
svgs: toNameContentObject(state.selectByTag("svgs")),
|
|
|
partials: toNameContentObject(state.selectByTag("partials")),
|
|
partials: toNameContentObject(state.selectByTag("partials")),
|
|
|
entries: entries,
|
|
entries: entries,
|
|
|
- sections: sections
|
|
|
|
|
|
|
+ sections: sections,
|
|
|
|
|
+ outputPath: currentItem.dirPath.slice(1)
|
|
|
},
|
|
},
|
|
|
template: matchingTemplate
|
|
template: matchingTemplate
|
|
|
};
|
|
};
|