API Endpoint to return all singles
Hi, I'd like to use Manifest with Astro's
getStaticPaths()
is there a simple way to return the slugs of all Singles?
Thanks!6 Replies
Hi @Father Friday , technically you could call the
/api/manifest
(https://demo-singles.manifest.build/api#/Manifest/get_api_manifest) to get a list of all entities and then return the slugs of it. However on many use cases it can make sense to hard code those slugs as you are going to use them in the interface and give them individual names. What is the reason to have those slugs dynamic ?If I were to give some one edit access to the .yaml file to create a new page I don't want them to have to add it in two places or mess with the build tool. I'll take a look at the manifest though 👍
@Father Friday you should not give access to the YAML file to someone to create a page, Manifest has an admin panel for that, you can give them credentials to the admin panel instead.
YAML file => DB structure (among others)
Admin panel => Record management (CRUD)
Point still stands, if they make a page on the admin panel I want the build tool to pick up on it automatically. I haven't played with the manifest API yet though, I'll let you know how it goes.
If you have a "Page" entity you can fetch all records with the "list" endpoint or JS SDK function and have Astro generate one page per record
Gotcha, so you'd suggest any user add-able pages should go under a page entity, then singles would be more appropriate for home page, about, etc - things the end user won't be adding or removing
Yeah, I'm happy with that solution. Loving it so far, thanks!