Skip to content

@scribe-atp/nuxt

nuxt.config.ts
export default defineNuxtConfig({
modules: ['@scribe-atp/nuxt'],
});

Once registered, useScribeSite and useScribeArticle are available in all components and pages without explicit imports.


function useScribeSite(
author: string,
publicationUrl: string,
options?: AsyncDataOptions
): Promise<AsyncData<Site | null, Error | null>>

Wraps fetchSite with useAsyncData. The composable is SSR-safe: data is fetched on the server and hydrated on the client.

Parameter Type Description
author string Author handle or DID
publicationUrl string The site’s canonical HTTPS URL, e.g. "https://alice.bsky.social"
options AsyncDataOptions Optional. Forwarded to useAsyncDatalazy, server, watch, etc.

Returns { data, pending, error, refresh } — the standard Nuxt AsyncData shape. data holds Site | null.


function useScribeArticle(
author: string,
articleSlug: string,
options?: AsyncDataOptions
): Promise<AsyncData<Article | null, Error | null>>

Wraps fetchArticle with useAsyncData.

Parameter Type Description
author string Author handle or DID
articleSlug string Article rkey / slug
options AsyncDataOptions Optional. Forwarded to useAsyncData

Returns { data, pending, error, refresh }. data holds Article | null.


function articleSeoMeta(article: Article, site: Site): UseSeoMetaInput

Returns a camelCase object shaped for Nuxt’s useSeoMeta() composable. Covers title, ogType, ogTitle, ogUrl, ogSiteName, ogDescription, ogImage, twitterCard, twitterTitle, twitterDescription, and twitterImage.

Parameter Type Description
article Article The full article object
site Site The site object
<script setup lang="ts">
import { articleSeoMeta } from '@scribe-atp/nuxt';
import { fetchArticleBySlug, fetchSite } from '@scribe-atp/core';
const route = useRoute();
const [{ article }, site] = await Promise.all([
fetchArticleBySlug('alice.bsky.social', 'https://alice.bsky.social', route.params.slug as string),
fetchSite('alice.bsky.social', 'https://alice.bsky.social'),
]);
useSeoMeta(articleSeoMeta(article, site));
</script>

This function is not auto-imported — use an explicit import from @scribe-atp/nuxt.


function siteSeoMeta(site: Site): UseSeoMetaInput

Returns useSeoMeta() input for a site index or group page.

Parameter Type Description
site Site The site object

All types from @scribe-atp/core are re-exported:

import type { Site, Article, ArticleRef, SiteGroup } from '@scribe-atp/nuxt';

See the core reference for type definitions.