Categories as a tree
borisschapira opened this issue · comments
Hello @tommy351,
I'm trying to add the generation of an index for the categories to hexo-generator-category. To do that, I want to pass to render and object representing the categories as a tree but locals.categories
only gives us a flatten projection.
I've managed to obtain a tree like that : https://github.com/borisschapira/hexo-generator-category/blob/master/lib/generator.js#L36
but it's not optimal, because I'm manipulating arrays and arrays are not ideal for templating. Is there a way to use warehouse
to obtain an unflatten representation of the categories from the flat one ?
What I'm doing with that (in a non-elegant way, for now) : http://next.borisschapira.com/categories/
Wow, it looks like we waited a long time for this one, @borisschapira. I'm closing it out. Hopefully we fixed it a while back.