Closed skipjack closed 7 years ago
Maybe it would be possible to tie this together with the schema change discussed at #126.
I've been thinking about this. The most sensible option seems to be to implement this as an Antwar plugin like prevnext currently. The algorithm would have to go through the entire path definition and attach the information there. I imagine it's not needed for all sites so that's another reason why a plugin feels like the right direction.
The most sensible option seems to be to implement this as an Antwar plugin like prevnext currently.
Idk, a lot of other static site generators have this as the default behavior that can then be overridden (e.g. via the frontmatter in phenomic). Personally, I think this makes sense as it's more intuitive and easier to manage.
I imagine it's not needed for all sites so that's another reason why a plugin feels like the right direction.
I think there may be some instances where overrides are needed but I can't picture that many sites where this wouldn't be the desired base behavior for the majority of routes/content. I guess it's not a huge deal to have it as a plugin but I think supporting it by default would make more sense.
Ok. I guess I'll develop it as a plugin (easier to test etc.) and just enable the behavior by default. So it could become an opt-out if necessary.
That sounds good, I can't argue with it being modularized and if we find out I'm wrong then it'll be even easier to fix 😁.
There's something like this built-in now behind section.all()
. I didn't pluginify the behavior just yet and the design can likely be improved. Better open separate issues for those based on need.
Sure we can also discuss more in webpack/webpack.js.org#980... it seems the data, section.all()
was the last thing (i.e. dynamic route generation seemed fine, just getting programmatic access to those routes was the problem). I've actually been doing some work on this for a separate project as in a webpack only solution that came out pretty nicely. Let's talk more on slack at some point...
Given the following antwar config:
and this content directory...
it would be great if antwar produced the routes and content in this manner:
/
- content fromindex.md
/another-page
- content fromanother-page.md
/examples
- content fromexamples/index.md
/examples/another-child
- content fromexamples/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 thesection.all()
data, these pages would be represented as: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).