Config Reference
Options for vuesho.config.ts.
vuesho.config.ts exports a site, created in three calls:
import { createSite, recommendedPreset } from "vuesho/config";
import { defineDocs } from "vuesho/content";
const docs = defineDocs();
export default createSite(docs.toSource(), {
// The content options: languages, slugs, icons, the page tree.
})
.plugins(recommendedPreset())
.config({
site: { name: "Acme Docs", baseUrl: "https://docs.acme.dev" },
head: [],
ui: { layoutProps: {}, colorMode: {} },
markdown: {},
});createSite()
The first argument is the content: one source, or an object of sources by key, like { docs: docs.toSource(), blog: blog.toSource() }. The second argument holds the content options, for every source:
Prop
Type
.plugins()
.plugins() takes your plugins, in order. It flattens arrays, skips false, null and undefined, and calls a function with the site's sources, so a plugin can read them at start:
createSite(docs.toSource()).plugins(
recommendedPreset(),
process.env.ANALYTICS === "1" && analyticsPlugin(),
);Plugin API covers writing a plugin.
.config()
site
Prop
Type
site.baseUrl is your deployed site's origin, without a base path. The sitemap, the RSS feed, canonical links and Open Graph images need it, as SEO shows. site.languages names each language on a site with i18n.
head
Head tags for every page, or a function that returns a page's tags.
ui
createSite(docs.toSource()).config({
ui: {
// The navbar, its links and the sidebar tabs of every layout.
layoutProps: { nav: { title: "Acme" } },
// The color mode before the reader picks one.
colorMode: { default: "dark" },
// The UI's texts, over its language packs.
translations: { "On this page(table of contents)": "Contents" },
},
});Each option has a guide:
layoutProps: NavigationcolorMode: Color Modetranslations: UI Translations
Prop
Type
Prop
Type
markdown
How pages compile. A collection can override these options.
Prop
Type
The slug module exports a function that returns a heading's ID from its text:
createSite(docs.toSource()).config({
markdown: { slug: "src/slug.ts" },
});recommendedPreset()
recommendedPreset() returns the plugins that most sites want. Each key turns its plugin off with false, and most keys also take that plugin's options:
createSite(docs.toSource()).plugins(
recommendedPreset({
// Each plugin is on by default: `false` turns it off, and an object passes its options.
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, with `site.baseUrl`
robots: {}, // robots.txt
rss: {}, // An RSS feed, with `site.baseUrl`
llms: {}, // llms.txt and each page's Markdown
linkValidation: {}, // Fails the build on a dead link
image: false, // Vercel's and Netlify's image optimizers
}),
);To replace one of the preset's plugins, turn it off with the preset's option and add the other plugin.
Prop
Type
Vite Plugin
vite.config.ts is optional. Write one to pass options to the Vuesho plugin, add other Vite plugins, or set Nitro options under nitro:
import { defineConfig } from "vite";
import vuesho from "vuesho/vite";
export default defineConfig({
plugins: [vuesho({ trailingSlash: true })],
nitro: { preset: "vercel" },
});With this file, vite dev, vite build and vite preview work like the CLI.
Prop
Type