|
|
@@ -160,7 +160,7 @@ module.exports = {
|
|
|
{
|
|
|
func: "renderTemplate",
|
|
|
deferConfig: true,
|
|
|
- selector: state => state.selectByTag("content"),
|
|
|
+ selector: state => state.selectByTag("content").selectByTag("index"),
|
|
|
getConfig: (state, currentItem) => {
|
|
|
const matchingTemplate = state
|
|
|
.selectByTag("pages")
|
|
|
@@ -181,14 +181,13 @@ module.exports = {
|
|
|
.selectByTag("index")
|
|
|
.not([currentItem])
|
|
|
.selectMany(item => item.depth <= currentItem.depth + 1);
|
|
|
- const isIndex = currentItem.tags.includes("index");
|
|
|
return {
|
|
|
meta: {
|
|
|
title: currentItem.niceName,
|
|
|
name: currentItem.name,
|
|
|
now: new Date().toLocaleString(),
|
|
|
context: currentItem.dirPath[1],
|
|
|
- isIndex: isIndex,
|
|
|
+ isIndex: true,
|
|
|
svgs: toNameContentObject(state.selectByTag("svgs")),
|
|
|
partials: toNameContentObject(state.selectByTag("partials")),
|
|
|
entries: entries,
|
|
|
@@ -199,6 +198,35 @@ module.exports = {
|
|
|
};
|
|
|
}
|
|
|
},
|
|
|
+ {
|
|
|
+ func: "renderTemplate",
|
|
|
+ deferConfig: true,
|
|
|
+ selector: state =>
|
|
|
+ state.selectByTag("content").not(state.selectByTag("index")),
|
|
|
+ getConfig: (state, currentItem) => {
|
|
|
+ const matchingTemplate = state
|
|
|
+ .selectByTag("pages")
|
|
|
+ .mostMatchingTags(currentItem.tags);
|
|
|
+ console.log(
|
|
|
+ `Rendering ${currentItem.dir}/${currentItem.name} with ${
|
|
|
+ matchingTemplate.dir
|
|
|
+ }/${matchingTemplate.name}`
|
|
|
+ );
|
|
|
+ return {
|
|
|
+ meta: {
|
|
|
+ title: currentItem.niceName,
|
|
|
+ name: currentItem.name,
|
|
|
+ now: new Date().toLocaleString(),
|
|
|
+ context: currentItem.dirPath[1],
|
|
|
+ isIndex: false,
|
|
|
+ svgs: toNameContentObject(state.selectByTag("svgs")),
|
|
|
+ partials: toNameContentObject(state.selectByTag("partials")),
|
|
|
+ trail: [...currentItem.dirPath.slice(1), currentItem.name]
|
|
|
+ },
|
|
|
+ template: matchingTemplate
|
|
|
+ };
|
|
|
+ }
|
|
|
+ },
|
|
|
{
|
|
|
func: "copy",
|
|
|
selector: state =>
|