基础配置

了解如何配置你的 Astro-VitePress 网站。

导航配置

编辑 src/config/site.ts 中的 navConfig 数组:

export const navConfig: NavItem[] = [
  { type: 'page', id: '/', text: '首页' },
  { type: 'folder', id: 'guide', text: '指南' },
  { type: 'folder', id: 'config', text: '配置' },
  { type: 'page', id: 'about', text: '关于' },
];

导航类型

侧边栏

侧边栏自动根据导航配置生成:

站点配置

src/config/site.ts 中集中管理所有站点元信息:

export const siteConfig = {
  name: 'Astro-VitePress',
  url: 'https://astro-vitepress.newmt.fun',
  author: 'scenlinx',
  description: '网站描述',
  keywords: '关键词',
  lang: 'zh-CN',
};

Frontmatter

每个 Markdown 文件通过 Frontmatter 配置页面元数据:

---
title: 页面标题
description: 页面描述
keywords: 关键词
date: '2026-06-02'
order: 1
---

常用字段

构建配置

astro.config.mjs 中可配置构建选项:

import { defineConfig } from 'astro/config';

export default defineConfig({
  site: 'https://example.com',
  build: {
    inlineStylesheets: 'auto',
  },
  markdown: {
    syntaxHighlight: 'shiki',
  },
});

更新于: 2026-06-02

Astro-VitePress — 基于 Astro 6 的零配置文档站点生成器