I’m trying to use Kirby as a headless CMS, and I’d like to pre-render most pages, so at build time, I use the API to get all the pages.
Well, this is proving quite problematic. First of all, I’ve already had to manually code a recursive function to get subpages as well as top-level pages. That’s unfortunate.
But my biggest issue is that I’m not finding any way at all to get a list on standalone pages.
So, questions:
Are standalone pages not accessible via the API? Or did I perhaps simply not find that endpoint yet?
Is there not a single request I can make to the API that can respond with a full deeply nested list of all pages, subpages and standalone pages?
I don’t really see why that would mean that any possible endpoint is provided by the system, given that you can add any endpoint you want and totally customize it to your needs.
Well, to be a headless CMS, you have to provide access to the content via the API.
Like you say, fetching a page whose ID you know is indeed supported out of the box.
But not being able to access the list of standalone pages via the API is definitely surprising and prohibitive in terms of a headless CMS…
@shawninder while most people are probably not using kirby fully headless if you search around you will find all kinds of plugins that help with this.
Kirby doesn’t give you everything out of the box but i think the power lies in the flexibility and ease of use to make your own. It’s more like toolkit for CMS than predefined CMS. That philosophy is everywhere. For example when you just install and look into Kirby Panel admin interface it will be empty - you have to do some work to use it. But it tends to be quick and pleasant work not some complicated mess.
Creating custom endpoint for pages will take very little time compared to the UI part for your site. But now you got superpower - you can make and use any endpoint with any data you want, wrap and cache other apis etc.