Skip to main content
Docus provides Vue composables for common documentation functionality. These composables are auto-imported and available in all components.

useSeo

Comprehensive SEO setup including meta tags, canonical URLs, hreflang tags, and JSON-LD structured data. Location: app/composables/useSeo.ts

Usage

Options

string | Ref<string>
required
Page title for meta tags and Open Graph.
string | Ref<string>
required
Page description for meta tags and Open Graph.
'website' | 'article'
default:"article"
Page type for og:type meta tag.
  • article - For documentation pages (includes Article schema)
  • website - For landing pages (includes WebSite schema)
string | Ref<string>
Custom Open Graph image URL (absolute URL).
string | Ref<string>
Published date in ISO 8601 format for Article schema.
string | Ref<string>
Last modified date in ISO 8601 format for Article schema.
BreadcrumbItem[] | Ref<BreadcrumbItem[]>
Breadcrumb items for BreadcrumbList JSON-LD schema.Each item should have:
  • title (string) - Breadcrumb label
  • path (string) - Breadcrumb URL path

Features

Meta Tags:
  • Title and description
  • Open Graph tags (og:title, og:description, og:type, og:url, og:locale)
  • Twitter Card tags
  • Canonical URL
Internationalization:
  • Automatic hreflang tags for all locales
  • x-default hreflang pointing to default locale
  • og:locale set to current locale
Structured Data (JSON-LD):
  • Article schema for documentation pages
  • WebSite schema for landing pages
  • BreadcrumbList schema for navigation
  • Publisher information from site config

Example with Full Options

useLogoAssets

Manage logo assets with copy, download, and context menu functionality. Location: app/composables/useLogoAssets.ts

Usage

Returned Properties

Whether a logo is configured in app.config.
Ref<'logo' | 'wordmark'>
Current display mode for the header.
Ref<string>
Current logo URL based on color mode.
Ref<string>
Logo URL for light mode header.
Ref<string>
Logo URL for dark mode header.
Ref<boolean>
Whether a wordmark is configured.
Ref<string>
Current wordmark URL based on color mode.
Ref<string>
Favicon URL from configuration.
Ref<string>
Alt text for the logo.
Ref<ContextMenuItem[][]>
Context menu items for the logo (copy, download, brand assets).

Methods

Copy logo SVG to clipboard (only works for SVG logos).Shows success/error toast notification.
Download logo file.Shows success toast notification.
() => Promise<void>
Copy wordmark SVG to clipboard (only works for SVG wordmarks).
() => Promise<void>
Download wordmark file.
(text: string) => Promise<boolean>
Utility function to copy text to clipboard.
(url: string, name: string) => Promise<string | null>
Fetch and normalize SVG content from a URL.

Features

Automatic SVG Normalization:
  • Replaces hard-coded colors with currentColor
  • Adds id and title elements for accessibility
  • Optimizes SVG for embedding
Context Menu Integration:
  • Copy logo (SVG only)
  • Copy wordmark (SVG only)
  • Download logo
  • Download wordmark
  • Link to brand assets page
Toast Notifications:
  • Success/error feedback for copy operations
  • Download confirmations

useDocusI18n

Unified internationalization interface that works with or without the @nuxtjs/i18n module. Location: app/composables/useDocusI18n.ts

Usage

Returned Properties

Ref<boolean>
Whether i18n is enabled in the project.
Ref<string>
Current locale code (e.g., 'en', 'fr').
LocaleObject[]
Array of configured locales with code and name properties.Returns empty array if i18n is not enabled.
(key: string) => string
Translation function.When i18n is disabled, uses fallback locale messages from Docus.
(path: string) => string
Generate localized path for a given route.When i18n is disabled, returns the path unchanged.
(locale: string) => string
Get the path for switching to a different locale.When i18n is disabled, returns undefined.

Features

Graceful Fallback:
  • Works without @nuxtjs/i18n module
  • Provides consistent API regardless of i18n configuration
  • Built-in translations for UI elements
Type Safety:
  • Full TypeScript support
  • Compatible with @nuxtjs/i18n types

Translation Keys

Built-in translation keys available:

useAssistant

Control the AI assistant panel state and functionality. Location: layer/modules/assistant/runtime/composables/useAssistant.ts

Usage

Returned Properties

Ref<boolean>
Whether the AI assistant is enabled in the configuration.
Ref<boolean>
Whether the assistant panel is currently open.
Ref<boolean>
Whether the assistant panel is in expanded mode (520px vs 360px).
Ref<boolean>
Whether the current viewport is mobile (max-width: 767px).
Ref<number>
Current panel width in pixels (360 for compact, 520 for expanded).
Ref<boolean>
Whether the assistant panel should push content aside (true when open on desktop).
Ref<UIMessage[]>
Array of chat messages in the current conversation.
Ref<string | undefined>
Message waiting to be sent when the panel opens.
Ref<FaqCategory[]>
FAQ questions configured in app.config.ts, normalized to category format.Automatically handles localized FAQ questions based on current locale.

Methods

(initialMessage?: string, clearPrevious?: boolean) => void
Open the assistant panel.Parameters:
  • initialMessage (optional) - Message to send when panel opens
  • clearPrevious (optional, default: false) - Clear previous messages before opening
() => void
Close the assistant panel.
() => void
Toggle the assistant panel open/closed state.
() => void
Toggle between compact (360px) and expanded (520px) panel widths.
() => void
Clear all messages from the current conversation.
() => void
Clear the pending message without sending it.

Features

Responsive Behavior:
  • Automatically detects mobile viewports
  • Adjusts panel width based on expanded state
  • Only pushes content on desktop viewports
Localization Support:
  • Handles localized FAQ questions
  • Falls back to default locale if current locale not available
  • Normalizes FAQ format (string arrays or category objects)
State Management:
  • Uses Nuxt’s useState for persistent state across navigation
  • Shared state between components
  • Reactive updates

Example: Custom Assistant Trigger

Type Definitions

UseSeoOptions