For the complete documentation index, see llms.txt. Prefer markdown by appending.mdto documentation URLs or sendingAccept: text/markdown.
Overview
Manage blog posts, docs, and marketing content in TurboStarter. Overview of the CMS setup, collections, and how content is sourced at build time.
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 @workspace/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.
import { getContentItems } from "@workspace/cms";
const { items, count } = getContentItems({
collection: CollectionType.BLOG,
tags: [ContentTag.SKILLS],
sortBy: "publishedAt",
sortOrder: SortOrder.DESCENDING,
status: ContentStatus.PUBLISHED,
locale: "en",
});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 bepublishedordraft. By default, onlypublisheditems are fetched.locale: The locale to fetch the items in. By default, all locales are fetched.
Fetching a single content item
To fetch a single content item, you can use the getContentItemBySlug function.
import { getContentItemBySlug } from "@workspace/cms";
const item = getContentItemBySlug({
collection: CollectionType.BLOG,
slug: "my-first-blog-post",
status: ContentStatus.PUBLISHED,
locale: "en",
});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 bepublishedordraft. By default, onlypublisheditems are fetched.locale: The locale to fetch the item in. By default, all locales are fetched.
Content Collections
Use Content Collections to type-check MDX content across the repo. Schema, transforms, and how docs, blog, and legal content are loaded.
Blog
Create, publish, and manage blog posts in TurboStarter. MDX frontmatter, locales, thumbnails, and the content workflow used on the marketing site.
How is this guide?
Last updated on