This repository was archived by the owner on Feb 11, 2022. It is now read-only.
This repository was archived by the owner on Feb 11, 2022. It is now read-only.
Reflect Content Structure in Routing Structure #124
Closed
Description
Given the following antwar config:
//...
'/': {
title: 'webpack',
path: function() {
return require.context(
'json-loader!yaml-frontmatter-loader!./content',
false,
/^\.\/.*\.md$/
);
},
processPage: processPage(),
layouts: {
index: function() {
return require('./components/splash/splash.jsx').default
},
page: function() {
return require('./components/page/page.jsx').default
}
}
}
// ...
and this content directory...
it would be great if antwar produced the routes and content in this manner:
/
- content from index.md
/another-page
- content from another-page.md
/examples
- content from examples/index.md
/examples/another-child
- content from examples/another-child.md
... and so on, treating each directory as a new route with children and the index.md
file as the content for the base route. Then within the section.all()
data, these pages would be represented as:
[
{
title: 'webpack',
url: '/',
content: 'content from index.md...',
pages: [
{ title: 'Another Page', url: '/another-page', content: 'content from another-page.md' },
{ title: 'Examples', url: '/examples', content: 'content from examples/index.md', pages: [
{ title: 'Another Child', url: '/examples/another-child', content: 'content from examples/another-child.md' }
]
]
}
]
This way your content structure always reflects your directory structure and much less manual configuration is needed to lay out your project (especially if all files are markdown).
Metadata
Metadata
Assignees
Labels
No labels