Skip to content

配置选项

本文档详细介绍了 Tiebo 项目的各种配置选项。

astro.config.mjs
export default defineConfig({
integrations: [
starlight({
title: 'Tiebo',
description: '温暖学术风格的文档站点',
})
]
});
sidebar: [
{
label: '分组名称',
collapsed: false, // true: 折叠, false: 展开
items: [
// 分组内容
]
}
]
sidebar: [
{
label: '主分组',
collapsed: false,
items: [
{
label: '子分组',
collapsed: true,
items: [
{ label: '页面标题', slug: 'path/to/page' }
]
}
]
}
]
{
label: '自动生成',
collapsed: true,
autogenerate: {
directory: 'docs/api',
collapsed: false // 子目录的折叠状态
}
}
:root {
/* 色彩系统 */
--color-primary: #8B4513;
--color-secondary: #D2691E;
--color-accent: #CD853F;
/* 字体系统 */
--font-family-body: 'Source Serif Pro', serif;
--font-family-heading: 'Playfair Display', serif;
--font-family-mono: 'JetBrains Mono', monospace;
/* 间距系统 */
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
--spacing-lg: 1.5rem;
--spacing-xl: 2rem;
}
[data-theme='dark'] {
--color-primary: #DEB887;
--color-background: #0D0A09;
--color-text-primary: #F5E6D3;
}
markdown: {
remarkPlugins: [remarkMath],
rehypePlugins: [[rehypeKatex, {
// KaTeX 配置
macros: { "\\RR": "\\mathbb{R}" },
trust: true,
strict: "warn"
}]]
}

每个 Markdown 文件支持以下配置:

---
title: 页面标题
description: 页面描述
template: splash # 可选:splash, page
sidebar:
order: 1 # 侧边栏排序
label: 自定义标签
---
.env
PUBLIC_SITE_URL=https://yoursite.com
PUBLIC_GITHUB_REPO=username/repo
{
"scripts": {
"dev": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
}
}
vercel.json
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"installCommand": "npm install"
}
netlify.toml
[build]
publish = "dist"
command = "npm run build"
[build.environment]
NODE_VERSION = "18"
astro.config.mjs
export default defineConfig({
image: {
domains: ['example.com'],
format: ['webp', 'avif']
}
});
export default defineConfig({
vite: {
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['astro']
}
}
}
}
}
});
{
"extends": [
"astro",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"no-console": "warn"
}
}
{
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5"
}

通过合理配置这些选项,可以打造出符合需求的文档站点。