Code Examples
Real-world code examples, integration guides, and recipes for building with SUPATENT.
Coming Soon
Code examples and recipes are currently being prepared.
In the meantime, the Tutorial documentation contains many code examples throughout the chapters.
Quick Snippets
Fetch Content with SDK
import { cms } from './lib/cms';
// Fetch all blog posts
const posts = await cms
.collection('blog-posts')
.all();
// Fetch single post by slug
const post = await cms
.collection('blog-posts')
.slug('my-first-post'); Using in Astro
---
import { cms, extractCollection } from '../lib/cms';
const result = await cms.collection('pages').all();
const pages = extractCollection(result);
---
{pages.map(page => (
<a href=`/${page.slug}`>
{page.title}
</a>
))}