I’m using Piranha Core 8 with Aspnetcore 3. So far everything is going well. (I love Piranha!)
My current problem is when building a Sidebar with a list of categories.
I can’t figure out how to retrieve all categories from the Api.

So far, I can get a list of posts, and perhaps iterate over them to collect the categories but this seems inefficient.

Any one know how to retrieve a list of all the categories from the cshtml pages?

You can get the full list of taxonomies per Archive by calling the Api.

var categories = await api.GetAllCategoriesAsync(archiveId);
var tags = await api.GetAllTagsAsync(archiveId);

Best regards


From the razor page I got it working this way :

        var archiveId = WebApp.CurrentPost == null ? WebApp.CurrentPage.Id : WebApp.CurrentPost.BlogId;
        var categories = await WebApp.Api.Posts.GetAllCategoriesAsync(archiveId);
        var tags = await WebApp.Api.Posts.GetAllTagsAsync(archiveId);