Current data mapping isn't very flexible, cannot map a single item or combine multiple. Therefore I think it should be changed to something like this:
{
"data": {
"posts": {
"content": "blog",
"sortBy": "date",
"order": "desc"
}
}
}
Now the key of an item inside "data" is the variable name, the content
in it would determine what to map to that variable. For example if the content
is just a string like blog
it will attempt to look for everything inside of a blog directory. However if you changed it to something like blog/hello-world.md
, then the only thing that would be mapped to that variable is that singular content item. Similarly, you could pass an array instead, like this:
{
"data": {
"posts": {
"content": ["thoughts", "ideas"],
"sortBy": "date",
"order": "desc"
}
}
}
And this would combine data from two different directories. You can also pass an array of actual content items for more fine control.
And we'd also want to group stuff, so we could pass an additional groupBy
to each data item which could take a meta key (easy to implement) and additionally what I would also like to have is to have some special grouping abilities for built-in special meta fields like date
. Say you wanted to group your blog posts by year, perhaps could pass it as groupBy: "date|year"
, or something of that nature. I think this would open up a lot of possibilities.