Published articles
Read published articles through the current SDK and distinguish missing content, outages and drafts.
Public read contract
ArticleSDK.list reads published results by language, page, category and keyword. Pair getBySlug with a language; a slug is unique within that language. getById/getBySlug return null only for HTTP 404 and throw for network, 5xx or malformed responses.
import type { Shell } from '@mosaic-base/shell';
import type { ArticleSDK, SiteSDK, I18nSDK } from '@mosaic-base/client-sdk';
import type { AuthClient, ServerAuthClient } from '@mosaic-base/auth-sdk';
// Declare once in your application's type contract, never import SDK implementations.
declare module '@mosaic-base/shell/contracts' {
interface SdkRegistry {
'site.config': Pick<SiteSDK, 'getConfig'>;
'content.articles': Pick<ArticleSDK, 'list' | 'getBySlug' | 'getPreview' | 'search'>;
'i18n.messages': Pick<I18nSDK, 'load' | 't' | 'clearCache' | 'refresh'>;
'auth.client': AuthClient | ServerAuthClient;
}
}
export async function readArticle(shell: Shell, slug: string) {
const articles = await shell.getSdk('content.articles');
const article = await articles.getBySlug(slug, 'en-US');
return article && { title: article.title, html: article.content, translations: article.translations };
}
// Null means missing/unpublished; service failures throw and need retry feedback.Safe editing and authorized preview
Administration saves append content snapshots and compare the editing revision. Publication names the confirmed version. Stale pages retain input and offer comparison and explicit server adoption, without automatically overwriting another editor.
Authorized preview binds the article, snapshot and language, so later saves do not change its body. A removed snapshot asks for a new link. Preview credentials contain no administrator session; public SDK reads still return published versions only.
Publication, translations and cache
Drafts are separate from public versions. Saving a later draft does not replace publication; publishing updates it and withdrawal removes anonymous access. translations lists published peers and their slugs. Missing article translations do not fall back to another language.
ArticleSDK only deduplicates identical in-flight reads and has no completed-result TTL cache. List failures never become successful empty lists.
Live SDK results
This section uses the actual public SDK on the server to read recent publications in the selected language, without drafts.