mengstack-website/.vitepress/config.ts
2026-10-02 23:55:36 +08:00

173 lines
7.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vitepress'
const seoPages: Record<string, { title: string; description: string; keywords: string }> = {
'/': {
title: 'MengStack - 企业级Go语言微服务开发框架 | 开源模块化开发底座',
description: 'MengStack是软盟SoftUnis开源的企业级Go语言微服务开发框架,基于Gin+GORM+uber-go/fx构建,内置三层隔离架构、多租户支持、JWT认证、API文档、Docker部署等能力,开箱即用,帮助开发者快速搭建企业级后端服务。',
keywords: 'Go微服务框架,Go企业级开发框架,MengStack,开源Go框架,Go模块化开发',
},
'/guide/what-is-mengstack': {
title: '什么是MengStack | 架构设计与核心特性介绍 - MengStack官方文档',
description: 'MengStack入门指南,详细介绍框架设计理念、三层隔离 Kernel/App/Modules 架构、四层模块模式、核心特性清单、适用场景与完整技术栈选型,帮助开发者快速了解MengStack框架。',
keywords: 'MengStack教程,MengStack架构,Go框架架构设计,DDD四层架构,Go微服务入门',
},
'/guide/getting-started': {
title: '快速开始 | 5分钟搭建MengStack项目环境 - MengStack官方文档',
description: 'MengStack快速开始教程,包含环境要求、项目克隆、依赖安装、配置修改、服务启动完整步骤,帮助开发者5分钟跑通第一个MengStack项目,快速体验框架能力。',
keywords: 'MengStack快速开始,MengStack安装,Go项目搭建,Go框架入门教程',
},
'/guide/project-structure': {
title: '项目结构说明 | MengStack目录规范详解 - MengStack官方文档',
description: '详细介绍MengStack标准项目目录结构,各目录职责划分、模块组织规范、依赖注入配置方式,帮助开发者遵循统一规范开发,降低团队协作成本。',
keywords: 'MengStack项目结构,Go项目目录规范,Go项目架构,模块化开发规范',
},
'/api/overview': {
title: 'API接口概览 | 统一响应格式与错误码说明 - MengStack官方文档',
description: 'MengStack API接口参考文档,包含接口基础信息、统一响应格式规范、HTTP状态码与错误码说明、JWT认证方式说明、完整接口列表,以及在线Swagger UI调试入口。',
keywords: 'MengStack API,Go接口文档,RESTful API规范,JWT认证接口,Swagger接口文档',
},
'/changelog': {
title: '更新日志 | 版本迭代记录与路线图 - MengStack开源框架',
description: 'MengStack各版本更新记录,包含v0.1.0首发版本技术栈说明、功能特性清单,以及后续版本路线图规划,跟进MengStack框架最新功能动态。',
keywords: 'MengStack更新日志,MengStack版本,Go框架更新,开源项目路线图',
},
'/demo': {
title: '在线演示 | 免费体验MengStack接口服务 - MengStack官方',
description: 'MengStack官方在线演示环境,提供公开API服务地址、Swagger UI在线调试入口、健康检查地址,附快速体验步骤指引,无需本地部署即可直接体验框架接口能力。',
keywords: 'MengStack在线演示,Go框架体验,Swagger在线调试,API接口测试',
},
'/community': {
title: '开发者社区 | 交流渠道与贡献指南 - MengStack开源社区',
description: 'MengStack开源开发者社区,提供代码仓库地址、问题反馈渠道、功能建议入口,以及Bug报告、代码提交、代码规范等贡献指引,欢迎所有开发者参与MengStack共建。',
keywords: 'MengStack社区,Go开源社区,Go开发者交流,开源项目贡献',
},
}
function getPagePath(relativePath: string) {
let p = '/' + relativePath.replace(/\.md$/, '').replace(/\/index$/, '')
if (p === '/index') p = '/'
return p
}
function getSeo(pagePath: string) {
return seoPages[pagePath] || seoPages['/']
}
export default defineConfig({
title: 'MengStack',
titleTemplate: ':title',
description: 'MengStack - 企业级 Go 语言微服务开发框架',
lang: 'zh-CN',
head: [
['link', { rel: 'icon', href: '/favicon.png' }],
['meta', { property: 'og:image', content: '/og-image.png' }],
['meta', { name: 'theme-color', content: '#C8963E' }],
],
transformHead({ pageData }) {
const path = getPagePath(pageData.relativePath)
const seo = getSeo(path)
const url = `https://mengstack.softunis.com${path === '/' ? '/' : path + '.html'}`
const head: [string, Record<string, string>][] = [
['meta', { name: 'description', content: seo.description }],
['meta', { name: 'keywords', content: seo.keywords }],
['link', { rel: 'canonical', href: url }],
['meta', { property: 'og:title', content: seo.title }],
['meta', { property: 'og:description', content: seo.description }],
['meta', { property: 'og:url', content: url }],
]
return head
},
themeConfig: {
logo: {
light: '/logo-light.png',
dark: '/logo-dark.png',
alt: 'MengStack 企业级Go语言微服务开发框架',
},
siteTitle: 'MengStack',
nav: [
{ text: '首页', link: '/' },
{ text: '指南', link: '/guide/what-is-mengstack' },
{ text: 'API 参考', link: '/api/overview' },
{ text: '更新日志', link: '/changelog' },
{ text: '在线演示', link: '/demo' },
{ text: '社区', link: '/community' },
],
sidebar: {
'/guide/': [
{
text: '入门',
items: [
{ text: '什么是 MengStack', link: '/guide/what-is-mengstack' },
{ text: '快速开始', link: '/guide/getting-started' },
{ text: '项目结构', link: '/guide/project-structure' },
],
},
{
text: '架构设计',
items: [
{ text: '三层隔离架构', link: '/guide/architecture' },
{ text: '模块四层模式', link: '/guide/module-pattern' },
{ text: '依赖注入', link: '/guide/dependency-injection' },
],
},
{
text: '核心功能',
items: [
{ text: '认证与授权', link: '/guide/auth' },
{ text: '多租户系统', link: '/guide/multi-tenancy' },
{ text: '配置管理', link: '/guide/configuration' },
],
},
{
text: '部署',
items: [
{ text: 'Docker 部署', link: '/guide/docker-deploy' },
{ text: 'CI/CD 流水线', link: '/guide/cicd' },
],
},
],
'/api/': [
{
text: 'API 参考',
items: [
{ text: '概览', link: '/api/overview' },
{ text: '认证接口', link: '/api/auth' },
{ text: '系统接口', link: '/api/system' },
],
},
],
},
socialLinks: [
{ icon: 'github', link: 'https://gitea.softunis.com/mengstack' },
],
footer: {
message: 'Released under the MIT License.',
copyright: `Copyright &copy; 2026 <a href="https://www.softunis.com/" target="_blank" rel="noopener">软盟 SoftUnis</a><br><a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener">粤ICP备2023054965号</a> &nbsp;|&nbsp; <a href="https://beian.mps.gov.cn/" target="_blank" rel="noopener">粤公网安备 44030502010466号</a>`,
},
search: {
provider: 'local',
},
outline: {
label: '页面导航',
},
docFooter: {
prev: '上一页',
next: '下一页',
},
lastUpdated: {
text: '最后更新',
},
},
})