API reference
@ghostwritr/vue has two entries. The core @ghostwritr/vue is data + SEO (no Markdown dependency); the @ghostwritr/vue/article-content subpath is the opt-in Markdown renderer. The fetchers and types are re-exported from the shared @ghostwritr/feed core, so the contract is identical across the Next / Astro / React Router / Vue SDKs. Peer: vue >= 3 (works in Nuxt 3 and plain Vue/Vite SSR).
Core — @ghostwritr/vue
Section titled “Core — @ghostwritr/vue”Functions
Section titled “Functions”| Export | Signature | Notes |
|---|---|---|
fetchArticles | (opts: FeedFetchOptions) => Promise<Article[]> | Keyless list read. Newest-first; never null (a feedless site throws NOT_FOUND). Call server-side. Re-exported from @ghostwritr/feed. |
fetchArticle | (opts: FeedFetchOptions & { slug: string }) => Promise<Article | null> | Keyless single read. Returns null when the feed exists but the slug doesn’t. Re-exported from @ghostwritr/feed. |
articleHead | (article: Article, opts?: ArticleHeadOptions) => ArticleHead | Pure function → a useHead() input (title, meta, canonical link, JSON-LD). See articleHead. |
verifyFeedSignature | (opts) => Promise<boolean> | Verify a signed feed.updated webhook before acting on it. See Instant updates. Re-exported from @ghostwritr/feed. |
Values
Section titled “Values”| Export | Type | Notes |
|---|---|---|
DEFAULT_STATIC_BASE_URL | string | The default feed origin (feeds.ghostwritr.io). Override via FeedFetchOptions.staticBaseUrl. Re-exported from @ghostwritr/feed. |
FEED_SIGNATURE_HEADER | string | The header name carrying the feed.updated signature. Re-exported from @ghostwritr/feed. |
GhostwritrError | class extends Error | The single thrown error type — status: number, code: GhostwritrErrorCode | null, details?: unknown. See Error handling. |
| Export | Notes |
|---|---|
FeedFetchOptions | { siteId, staticBaseUrl?, order?, ... } — the fetcher input. |
Article | The published-article shape. See The article shape. |
ArticleImage | The cover image (url, alt, width, height, srcset), or null on the article. |
ArticleOrder | "published-desc" (default) | "feed". |
Author | The byline — kind: "real" | "persona" drives Person vs Organization JSON-LD. |
FeedUpdatedPayload | The verified feed.updated webhook body. |
GhostwritrErrorCode | The code union — CONFIG, NETWORK_ERROR, NOT_FOUND, RATE_LIMITED, SERVER_ERROR, INVALID_RESPONSE, … |
ArticleHead | The articleHead return value (a useHead() input subset). Local to @ghostwritr/vue. |
ArticleHeadOptions | { url?, siteName?, twitterSite? } — the articleHead options. Local to @ghostwritr/vue. |
import { fetchArticles, fetchArticle, articleHead, verifyFeedSignature, DEFAULT_STATIC_BASE_URL, FEED_SIGNATURE_HEADER, GhostwritrError,} from "@ghostwritr/vue";import type { FeedFetchOptions, Article, ArticleImage, ArticleOrder, Author, FeedUpdatedPayload, GhostwritrErrorCode, ArticleHead, ArticleHeadOptions,} from "@ghostwritr/vue";Renderer — @ghostwritr/vue/article-content
Section titled “Renderer — @ghostwritr/vue/article-content”A separate, opt-in entry that keeps the Markdown dependencies out of data-only consumers.
| Export | Kind | Notes |
|---|---|---|
ArticleContent | Vue component | Renders markdown to sanitized HTML. See Rendering articles. |
renderMarkdown | (markdown: string, opts?) => string | The underlying synchronous Markdown → sanitized-HTML function. |
ArticleContentProps | type | { markdown, class?, remarkPlugins?, rehypePlugins? }. |
ArticleContent props:
| Prop | Type | Default |
|---|---|---|
markdown | string | — (required) |
class | string | undefined |
remarkPlugins | PluggableList | undefined (appended after remark-gfm) |
rehypePlugins | PluggableList | undefined (appended after rehype-sanitize) |
renderMarkdown(markdown, opts?) takes the same { remarkPlugins?, rehypePlugins? } and returns the sanitized HTML string.
import { ArticleContent, renderMarkdown } from "@ghostwritr/vue/article-content";import type { ArticleContentProps } from "@ghostwritr/vue/article-content";