Use theme local options
Co-Authored-By: Daniel Ding <41363844+BioniCosmos@users.noreply.github.com>pull/13/head
parent
f1671b156f
commit
092ee395d8
|
@ -1,5 +1,6 @@
|
|||
import { defineUserConfig } from "vuepress";
|
||||
import { DefaultThemeOptions } from "vuepress";
|
||||
import { defineUserConfig, DefaultThemeOptions } from "vuepress";
|
||||
import * as sidebar from "./config/sidebar";
|
||||
import * as navbar from "./config/navbar";
|
||||
import * as path from "path";
|
||||
|
||||
export default defineUserConfig<DefaultThemeOptions>({
|
||||
|
@ -16,151 +17,43 @@ export default defineUserConfig<DefaultThemeOptions>({
|
|||
themeConfig: {
|
||||
smoothScroll: true,
|
||||
repo: "xtls/xray-core",
|
||||
repoLabel: "查看源码",
|
||||
docsRepo: "xtls/Xray-docs-next",
|
||||
docsDir: "docs",
|
||||
docsBranch: "main",
|
||||
editLinks: true,
|
||||
editLinkText: "帮助我们改善此页面!",
|
||||
enableToggle: true,
|
||||
navbar: [
|
||||
{ text: "首页", link: "/" },
|
||||
{ text: "大史记", link: "/about/news.md" },
|
||||
{ text: "配置指南", link: "/config/" },
|
||||
{ text: "开发指南", link: "/development/" },
|
||||
{ text: "使用指南", link: "/document/" },
|
||||
{
|
||||
text: "多语言",
|
||||
ariaLabel: "Language Menu",
|
||||
children: [
|
||||
{ text: "简体中文", link: "/" },
|
||||
{ text: "English", link: "/en" },
|
||||
],
|
||||
},
|
||||
],
|
||||
sidebar: {
|
||||
"/config/": [
|
||||
{
|
||||
text: "特性详解",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/config/features/vless.md",
|
||||
"/config/features/xtls.md",
|
||||
"/config/features/fallback.md",
|
||||
"/config/features/env.md",
|
||||
"/config/features/multiple.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "基础配置",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/config/",
|
||||
"/config/api.md",
|
||||
"/config/dns.md",
|
||||
"/config/fakedns.md",
|
||||
"/config/inbound.md",
|
||||
"/config/outbound.md",
|
||||
"/config/policy.md",
|
||||
"/config/reverse.md",
|
||||
"/config/routing.md",
|
||||
"/config/stats.md",
|
||||
"/config/transport.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "入站代理",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/config/inbounds/",
|
||||
"/config/inbounds/dokodemo.md",
|
||||
"/config/inbounds/http.md",
|
||||
"/config/inbounds/shadowsocks.md",
|
||||
"/config/inbounds/socks.md",
|
||||
"/config/inbounds/trojan.md",
|
||||
"/config/inbounds/vless.md",
|
||||
"/config/inbounds/vmess.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "出站代理",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/config/outbounds/",
|
||||
"/config/outbounds/blackhole.md",
|
||||
"/config/outbounds/dns.md",
|
||||
"/config/outbounds/freedom.md",
|
||||
"/config/outbounds/http.md",
|
||||
"/config/outbounds/shadowsocks.md",
|
||||
"/config/outbounds/socks.md",
|
||||
"/config/outbounds/trojan.md",
|
||||
"/config/outbounds/vless.md",
|
||||
"/config/outbounds/vmess.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: "底层传输",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/config/transports/",
|
||||
"/config/transports/grpc.md",
|
||||
"/config/transports/h2.md",
|
||||
"/config/transports/mkcp.md",
|
||||
"/config/transports/quic.md",
|
||||
"/config/transports/tcp.md",
|
||||
"/config/transports/websocket.md",
|
||||
],
|
||||
},
|
||||
],
|
||||
"/document/level-0/": [
|
||||
{
|
||||
text: "小小白白话文",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/document/level-0/ch01-preface.md",
|
||||
"/document/level-0/ch02-preparation.md",
|
||||
"/document/level-0/ch03-ssh.md",
|
||||
"/document/level-0/ch04-security.md",
|
||||
"/document/level-0/ch05-webpage.md",
|
||||
"/document/level-0/ch06-certificates.md",
|
||||
"/document/level-0/ch07-xray-server.md",
|
||||
"/document/level-0/ch08-xray-clients.md",
|
||||
"/document/level-0/ch09-appendix.md",
|
||||
],
|
||||
},
|
||||
],
|
||||
"/document/level-1/": [
|
||||
{
|
||||
text: "入门技巧",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/document/level-1/fallbacks-lv1.md",
|
||||
"/document/level-1/routing-lv1-part1.md",
|
||||
"/document/level-1/routing-lv1-part2.md",
|
||||
"/document/level-1/work.md",
|
||||
"/document/level-1/fallbacks-with-sni.md",
|
||||
],
|
||||
},
|
||||
],
|
||||
"/document/level-2/": [
|
||||
{
|
||||
text: "进阶技巧",
|
||||
isGroup: true,
|
||||
children: [
|
||||
"/document/level-2/transparent_proxy/transparent_proxy.md",
|
||||
"/document/level-2/tproxy.md",
|
||||
"/document/level-2/iptables_gid.md",
|
||||
"/document/level-2/redirect.md",
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
themePlugins: {
|
||||
git: process.env.NODE_ENV === "production",
|
||||
},
|
||||
locales: {
|
||||
"/": {
|
||||
ToggleText: "切换主题",
|
||||
repoLabel: "查看源码",
|
||||
editLinkText: "帮助我们改善此页面!",
|
||||
sidebar: {
|
||||
"/config/": sidebar.getConfigSidebar(
|
||||
"特性详解",
|
||||
"基础配置",
|
||||
"入站代理",
|
||||
"出站代理",
|
||||
"底层传输",
|
||||
"/config/"
|
||||
),
|
||||
"/document/level-0/": sidebar.getDocumentLv0Sidebar(
|
||||
"小小白白话文",
|
||||
"/document/level-0/"
|
||||
),
|
||||
"/document/level-1/": sidebar.getDocumentLv1Sidebar(
|
||||
"入门技巧",
|
||||
"/document/level-1/"
|
||||
),
|
||||
"/document/level-2/": sidebar.getDocumentLv2Sidebar(
|
||||
"进阶技巧",
|
||||
"/document/level-2/"
|
||||
),
|
||||
},
|
||||
navbar: navbar.hans,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
import { NavbarConfig } from "@vuepress/theme-default/lib/types/nav";
|
||||
|
||||
export const hans: NavbarConfig = [
|
||||
{ text: "首页", link: "/" },
|
||||
{ text: "大史记", link: "/about/news.md" },
|
||||
{ text: "配置指南", link: "/config/" },
|
||||
{ text: "开发指南", link: "/development/" },
|
||||
{ text: "使用指南", link: "/document/" },
|
||||
{
|
||||
text: "多语言",
|
||||
ariaLabel: "Language Menu",
|
||||
children: [
|
||||
{ text: "简体中文", link: "/" },
|
||||
{ text: "English", link: "/en" },
|
||||
],
|
||||
},
|
||||
];
|
|
@ -0,0 +1,146 @@
|
|||
import { SidebarConfigArray } from "@vuepress/theme-default/lib/types/nav";
|
||||
|
||||
export function getConfigSidebar(
|
||||
feature: string,
|
||||
config: string,
|
||||
inbound: string,
|
||||
outbound: string,
|
||||
transport: string,
|
||||
path: string
|
||||
): SidebarConfigArray {
|
||||
return [
|
||||
{
|
||||
text: feature,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "features/vless.md",
|
||||
path + "features/xtls.md",
|
||||
path + "features/fallback.md",
|
||||
path + "features/env.md",
|
||||
path + "features/multiple.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: config,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "",
|
||||
path + "api.md",
|
||||
path + "dns.md",
|
||||
path + "fakedns.md",
|
||||
path + "inbound.md",
|
||||
path + "outbound.md",
|
||||
path + "policy.md",
|
||||
path + "reverse.md",
|
||||
path + "routing.md",
|
||||
path + "stats.md",
|
||||
path + "transport.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: inbound,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "inbounds/",
|
||||
path + "inbounds/dokodemo.md",
|
||||
path + "inbounds/http.md",
|
||||
path + "inbounds/shadowsocks.md",
|
||||
path + "inbounds/socks.md",
|
||||
path + "inbounds/trojan.md",
|
||||
path + "inbounds/vless.md",
|
||||
path + "inbounds/vmess.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: outbound,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "outbounds/",
|
||||
path + "outbounds/blackhole.md",
|
||||
path + "outbounds/dns.md",
|
||||
path + "outbounds/freedom.md",
|
||||
path + "outbounds/http.md",
|
||||
path + "outbounds/shadowsocks.md",
|
||||
path + "outbounds/socks.md",
|
||||
path + "outbounds/trojan.md",
|
||||
path + "outbounds/vless.md",
|
||||
path + "outbounds/vmess.md",
|
||||
],
|
||||
},
|
||||
{
|
||||
text: transport,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "transports/",
|
||||
path + "transports/grpc.md",
|
||||
path + "transports/h2.md",
|
||||
path + "transports/mkcp.md",
|
||||
path + "transports/quic.md",
|
||||
path + "transports/tcp.md",
|
||||
path + "transports/websocket.md",
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function getDocumentLv0Sidebar(
|
||||
title: string,
|
||||
path: string
|
||||
): SidebarConfigArray {
|
||||
return [
|
||||
{
|
||||
text: title,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "ch01-preface.md",
|
||||
path + "ch02-preparation.md",
|
||||
path + "ch03-ssh.md",
|
||||
path + "ch04-security.md",
|
||||
path + "ch05-webpage.md",
|
||||
path + "ch06-certificates.md",
|
||||
path + "ch07-xray-server.md",
|
||||
path + "ch08-xray-clients.md",
|
||||
path + "ch09-appendix.md",
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function getDocumentLv1Sidebar(
|
||||
title: string,
|
||||
path: string
|
||||
): SidebarConfigArray {
|
||||
return [
|
||||
{
|
||||
text: title,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "fallbacks-lv1.md",
|
||||
path + "routing-lv1-part1.md",
|
||||
path + "routing-lv1-part2.md",
|
||||
path + "work.md",
|
||||
path + "fallbacks-with-sni.md",
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export function getDocumentLv2Sidebar(
|
||||
title: string,
|
||||
path: string
|
||||
): SidebarConfigArray {
|
||||
return [
|
||||
{
|
||||
text: title,
|
||||
isGroup: true,
|
||||
children: [
|
||||
path + "transparent_proxy/transparent_proxy.md",
|
||||
path + "tproxy.md",
|
||||
path + "iptables_gid.md",
|
||||
path + "redirect.md",
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export const a = "";
|
Loading…
Reference in New Issue