Using Plugins
Add and configure plugins.
Every Vuesho feature is a plugin, like search, the sitemap and the API references. You add plugins in the config's .plugins().
Adding a Plugin
Install the plugin's package, if it has one, and list the plugin in .plugins(). This example adds status badges to the sidebar:
import { createSite, recommendedPreset } from "vuesho/config";
import { defineDocs } from "vuesho/content";
import { statusBadgesPlugin } from "vuesho/status-badges";
const docs = defineDocs();
export default createSite(docs.toSource()).plugins(
recommendedPreset(),
statusBadgesPlugin(),
);.plugins() skips false, null and undefined, so a condition can turn a plugin on and off:
createSite(docs.toSource()).plugins(
recommendedPreset(),
process.env.ANALYTICS === "1" && analyticsPlugin(),
);The build and the server both run vuesho.config.ts, so base the condition on something both can read, like an environment variable.
Configuring the Preset
recommendedPreset() returns the plugins that most sites want. Each key passes options to its plugin, or turns the plugin off with false. codeTabs and image take only false:
createSite(docs.toSource()).plugins(
recommendedPreset({
codeTabs: false, // Code blocks with `tab` become tabs
npm: {}, // `npm` code blocks become a tab per package manager
search: {}, // Search with MiniSearch
sitemap: {}, // sitemap.xml, which needs `site.baseUrl`
robots: {}, // robots.txt
rss: {}, // An RSS feed, which needs `site.baseUrl`
llms: {}, // llms.txt and the Markdown version of each page
linkValidation: {}, // Fail the build on a dead link
image: false, // The image optimizers of Vercel and Netlify
}),
);Replacing a Plugin
To replace one of the preset's plugins, turn off its key and add the other plugin:
import { algoliaPlugin } from "@vuesho/algolia";
createSite(docs.toSource()).plugins(
recommendedPreset(),
recommendedPreset({ search: false }),
algoliaPlugin({/* ... */}),
);When you add a preset plugin yourself, like sitemapPlugin() from vuesho/config, turn off the preset's copy so the same work doesn't run twice.
Plugin Order
The built-ins run first, then the site's plugins in their order in .plugins(). A later plugin overrides an earlier one, and .config() options take priority over the plugins'. See Plugin API.
Official Plugins
Built into vuesho, besides the recommended preset:
lucideIconsPlugin()for icon names, andstatusBadgesPlugin()for status badgesstepsPlugin(),filesPlugin()andmermaidPlugin()for Steps, Files and MermaidadmonitionsPlugin()for containers and alertsogImagePlugin()for Open Graph images
Packages:
- Blog, Changelog, Feedback, Graph View, and EPUB and PDF
- Twoslash, Type Tables and Stories
- AI chat and MCP server
- Search services: Algolia, Orama Cloud, Meilisearch, Typesense and Mixedbread
- API docs: OpenAPI, GraphQL, AsyncAPI and Python
- Content sources: Notion, Sanity, Obsidian and local files
- Mintlify, to run a Mintlify project
To write a plugin, see Plugin API.