Posts
Use the SDK to list posts and fetch full post content
Use SDK methods for post listing and detail pages.
List posts
import { Hive } from 'hive-cms';
const hive = new Hive();
const posts = await hive.posts.list({
limit: 10,
offset: 0,
category: 'product',
tags: ['updates'],
author: 'auth_01',
});Common filters
limitandoffsetfor paginationcategoryfor category slugtagsfor tag slug arrayauthorfor author id
Get one post by slug
const post = await hive.posts.get('welcome-to-hive');
console.log(post.htmlContent);Rendering tip
post.htmlContent is trusted output from Hive content. Render according to your framework's HTML strategy.
Error handling
import { HiveApiError } from 'hive-cms';
try {
await hive.posts.get('missing-slug');
} catch (error) {
if (error instanceof HiveApiError) {
console.error(error.message);
}
}Technical notes
- SDK defaults to
v1. - You can override base URL and version in constructor options.
Full API details
See API Reference: Posts.