Skip to content

配置文件示例

ts
// .vitepress/config.mts
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: "Note",
  description: "学习笔记",
  markdown: {
    math: true,  // 启用数学公式
  },
  themeConfig: {
    // https://vitepress.dev/reference/default-theme-config
    logo: '/logo.svg',
    nav: [
      { text: 'Home', link: '/' },
      { text: 'Examples', link: '/markdown-examples' }
    ],
    // 显示标题的层级
    outline: {
      level: [1, 5],  // 显示标题的层级, 2为显示2级标题, 5为显示5级标题
    },

    sidebar: [
      {
        text: 'Examples',
        items: [
          { text: 'Markdown Examples', link: '/markdown-examples' },
          { text: 'Runtime API Examples', link: '/api-examples' },
        ]
      },
      
    ],

    socialLinks: [
      { icon: 'github', link: 'https://github.com/vuejs/vitepress' }
    ],
    search: {
      provider: 'local',    // 本地搜索功能
      options: {
        locales: {
          zh: {
            translations: {
              button: {
                buttonText: '搜索文档',
                buttonAriaLabel: '搜索文档'
              },
              modal: {
                noResultsText: '无法找到相关结果',
                resetButtonTitle: '清除查询条件',
                footer: {
                  selectText: '选择',
                  navigateText: '切换'
                }
              }
            }
          }
        }
      }
    },
    siteTitle: '哈哈哈',   // 站点标题
  },
  head: [['link', { rel: 'icon', href: '/logo.svg' }]],    // 设置icon
  cleanUrls: true,    // 将网址后面的.html去掉
  lastUpdated: true, // 启用最后更新时间
  outDir: 'G:/Code/Note/.vitepress/Note',  // 设置输出目录
})