Files
ESP-Claw/docs/astro.config.mjs
2026-04-20 21:41:15 +08:00

108 lines
2.7 KiB
JavaScript

// @ts-check
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import { fileURLToPath } from "url";
import starlightThemeNova from "starlight-theme-nova";
import astroD2 from "astro-d2";
import { remarkDocLinks } from "./src/plugins/remark-doc-links.ts";
const BASE = "/esp-claw/";
export default defineConfig({
base: BASE,
integrations: [
astroD2(),
starlight({
title: "ESP-Claw Docs",
favicon: "/esp-claw/favicon.ico",
social: [
{
icon: "github",
label: "GitHub",
href: "https://github.com/espressif/esp-claw",
},
],
sidebar: [
{
label: "Tutorial",
translations: {
en: "Tutorial",
"zh-CN": "Tutorial",
},
items: [
{ slug: "tutorial", label: "Welcome", translations: { en: "Welcome", "zh-CN": "欢迎" } }, // `index.mdx`
{ slug: "tutorial/bom" },
{ slug: "tutorial/assemble" },
{ slug: "tutorial/get-started" },
{ slug: "tutorial/web-config" },
{ slug: "tutorial/faq" },
],
},
{
label: "Reference",
items: [
{
label: "Project Architecture",
autogenerate: { directory: "reference-project" },
translations: {
en: "Project Architecture",
"zh-CN": "项目架构",
},
},
{
label: "Core",
autogenerate: { directory: "reference-core" },
translations: {
en: "Core",
"zh-CN": "核心 Core",
},
},
{
label: "Capabilities",
autogenerate: { directory: "reference-cap" },
translations: {
en: "Capabilities",
"zh-CN": "能力 Capabilities",
},
},
],
translations: {
en: "Reference",
"zh-CN": "参考",
},
},
],
customCss: ["./src/styles/starlight.css"],
defaultLocale: "en",
locales: {
en: {
label: "English",
lang: "en",
},
"zh-cn": {
label: "中文",
lang: "zh-CN",
},
},
components: {
SiteTitle: "./src/components/DocsSiteTitle.astro",
Sidebar: "./src/components/Sidebar.astro",
},
plugins: [
starlightThemeNova(),
],
}),
],
markdown: {
remarkPlugins: [[remarkDocLinks, { base: BASE }]],
},
vite: {
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
},
});