Showing subcategories recent posts under categories on home page
-
Hi
On my home page, I would like to not only show recent posts strictly in the category, but recent posts of the category + its subcategories. I think it's not possible with the json currently returned by the API for
/
.
So how can I achieve that? I would need to get the most recent posts of the sum of all posts under this category's tree.Thanks
-
Recent posts from child categories are returned but not with the parent's posts. For example here is the output of the api with a child category and a post inside it.
{ ... "children": [ { ... "posts": [ { "pid": "13316", "tid": "1902", "content": "<p>child category post</p>\n", "uid": "1", "timestamp": "1417109315798", "deleted": "0", "index": 1, "user": { }, "topic": { }, "category": { }, "relativeTime": "2014-11-27T17:28:35.798Z" } ] } ], "parent": null, "posts": [ { "pid": "13170", "tid": "1757", "content": "", "uid": "246", "timestamp": "1411514894553", "deleted": "0", "index": 10, "user": { }, "topic": { }, "category": { }, "relativeTime": "2014-09-23T23:28:14.553Z" } ] },
-
@baris Thanks, but there's no way to just get all the most recent posts in a category, including all subcategories posts? The templating engine doesn't seem to allow anything too complicated (nor anything complicated at all in fact), so I don't think I can like aggregate the different arrays and sort them...
Maybe it's something that you should be able to configure? Subcategories is a quite recent addition so it's normal that no such thing has been implemented / thinked about yet, but maybe it's something you might want to have.
I really want all my posts on my main page (WIP theme http://nodebb-test.ribesg.fr/)