Overview
Manage your content in TurboStarter.
TurboStarter implements a CMS interface that abstracts the implementation from where you store your data. It provides a simple API to interact with your data, and it's easy to extend and customize.
By default, the starter kit ships with these implementations in place:
- Content Collections - a headless CMS that uses MDX files to store your content.
The implementation is available under @turbostarter/cms
package, here we'll go over how to use it.
API
The CMS package provides a simple, unified API to interact with the content. It's the same for all the providers, so you can easily use it with any of the implementations without changing the code.
Fetching content items
To fetch items from your colletions, you can use the getContentItems
function.
It accepts an object with the following properties:
collection
: The collection to fetch the items from.tags
: The tags to filter the items by.sortBy
: The field to sort the items by.sortOrder
: The order to sort the items in.status
: The status of the items to fetch. It can bepublished
ordraft
. By default, onlypublished
items are fetched.
Fetching a single content item
To fetch a single content item, you can use the getContentItemBySlug
function.
It accepts an object with the following properties:
collection
: The collection to fetch the item from.slug
: The slug of the item to fetch.status
: The status of the item to fetch. It can bepublished
ordraft
. By default, onlypublished
items are fetched.
Last updated on