From 641c16ee7a813ee1c41dc8cf4a06d1af3379b973 Mon Sep 17 00:00:00 2001 From: Snowykami Date: Sat, 8 Mar 2025 23:21:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20=E6=96=87=E6=A1=A3=E5=BC=95?= =?UTF-8?q?=E5=85=A5=E7=A5=9E=E7=A7=98js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/.vitepress/config/common.ts | 230 ++++++++++++++++--------------- 1 file changed, 117 insertions(+), 113 deletions(-) diff --git a/docs/.vitepress/config/common.ts b/docs/.vitepress/config/common.ts index 9d623c07..72a424ca 100755 --- a/docs/.vitepress/config/common.ts +++ b/docs/.vitepress/config/common.ts @@ -1,21 +1,21 @@ // 共有配置项,导入index用 -import { defineConfig } from 'vitepress' -import { generateSidebar } from 'vitepress-sidebar'; +import { defineConfig } from "vitepress"; +import { generateSidebar } from "vitepress-sidebar"; import { zh } from "./zh"; import { en } from "./en"; -let defaultLocale = 'zh'; +let defaultLocale = "zh"; const commonSidebarOptions = { - collapsed: true, - convertSameNameSubFileToGroupIndexPage: true, - useTitleFromFrontmatter: true, - useFolderTitleFromIndexFile: true, - useFolderLinkFromIndexFile: true, - includeFolderIndexFile: true, - sortMenusByFrontmatterOrder: true, - rootGroupText: 'LITEYUKIBOT', -} + collapsed: true, + convertSameNameSubFileToGroupIndexPage: true, + useTitleFromFrontmatter: true, + useFolderTitleFromIndexFile: true, + useFolderLinkFromIndexFile: true, + includeFolderIndexFile: true, + sortMenusByFrontmatterOrder: true, + rootGroupText: "LITEYUKIBOT", +}; /** * Generate sidebar config @@ -23,115 +23,119 @@ const commonSidebarOptions = { * @returns {any[]} */ function generateSidebarConfig(): any[] { - let sections = ["dev", "store", "usage", "deploy"] - let languages = ['zh', 'en'] - let ret = [] - for (let language of languages) { - for (let section of sections) { - if (language === defaultLocale) { - ret.push({ - basePath: `/${section}/`, - scanStartPath: `${language}/${section}`, - resolvePath: `/${section}/`, - ...commonSidebarOptions - }) - } else { - ret.push({ - basePath: `/${language}/${section}/`, - scanStartPath: `${language}/${section}`, - resolvePath: `/${language}/${section}/`, - ...commonSidebarOptions - }) - } - } + let sections = ["dev", "store", "usage", "deploy"]; + let languages = ["zh", "en"]; + let ret = []; + for (let language of languages) { + for (let section of sections) { + if (language === defaultLocale) { + ret.push({ + basePath: `/${section}/`, + scanStartPath: `${language}/${section}`, + resolvePath: `/${section}/`, + ...commonSidebarOptions, + }); + } else { + ret.push({ + basePath: `/${language}/${section}/`, + scanStartPath: `${language}/${section}`, + resolvePath: `/${language}/${section}/`, + ...commonSidebarOptions, + }); + } } - return ret + } + return ret; } - export const common = defineConfig({ - head: [ - // 配置favicon.ico - ['link', { rel: 'icon', type: 'image/x-icon', href: 'favicon.ico' }], - ['link', { rel: 'stylesheet', href: 'https://fonts.font.im/css?family=Cousine:400,400i,700,700i|Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i' }], + head: [ + // 配置favicon.ico + [ + "script", + { async: "", src: "https://cdn.liteyuki.icu/js/liteyuki_footer.js" }, ], - rewrites: { - [`${defaultLocale}/:rest*`]: ":rest*", + ["link", { rel: "icon", type: "image/x-icon", href: "favicon.ico" }], + [ + "link", + { + rel: "stylesheet", + href: "https://fonts.font.im/css?family=Cousine:400,400i,700,700i|Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i", + }, + ], + ], + rewrites: { + [`${defaultLocale}/:rest*`]: ":rest*", + }, + cleanUrls: false, + themeConfig: { + logo: { + light: "/liteyuki.svg", + dark: "/liteyuki-dark.svg", + alt: "LiteyukiBot Logo", }, - cleanUrls: false, - themeConfig: { - logo: { - light: '/liteyuki.svg', - dark: '/liteyuki-dark.svg', - alt: 'LiteyukiBot Logo' + sidebar: generateSidebar([...generateSidebarConfig()]), + socialLinks: [ + { icon: "github", link: "https://github.com/LiteyukiStudio/LiteyukiBot" }, + { + icon: { + svg: '', }, - sidebar: generateSidebar( - [ - ...generateSidebarConfig() - ] - ), - socialLinks: [ - { icon: 'github', link: 'https://github.com/LiteyukiStudio/LiteyukiBot' }, - { - icon: { - svg: '' + link: "https://git.liteyuki.icu/bot/app", + }, + { + icon: { + svg: '', + }, + link: "https://lab.liteyuki.icu/@LiteyukiBot", + }, + ], + search: { + provider: "local", + options: { + locales: { + root: { + translations: { + button: { + buttonText: "搜索文档", + buttonAriaLabel: "打开搜索框", + }, + modal: { + noResultsText: "没有找到搜索结果", + resetButtonTitle: "清除查询条件", + footer: { + selectText: "选择", + navigateText: "切换", }, - link: "https://git.liteyuki.icu/bot/app" + }, }, - { - icon:{ - svg:'' + }, + en: { + translations: { + button: { + buttonText: "Search", + buttonAriaLabel: "Search", + }, + modal: { + noResultsText: "No results found", + resetButtonTitle: "Reset search query", + footer: { + selectText: "Select", + navigateText: "Navigate", }, - link: 'https://lab.liteyuki.icu/@LiteyukiBot' - } - ], - search: { - provider: 'local', - options: { - locales: { - root: { - translations: { - button: { - buttonText: '搜索文档', - buttonAriaLabel: '打开搜索框', - }, - modal: { - noResultsText: '没有找到搜索结果', - resetButtonTitle: '清除查询条件', - footer: { - selectText: '选择', - navigateText: '切换', - } - } - }, - }, - en: { - translations: { - button: { - buttonText: 'Search', - buttonAriaLabel: 'Search', - }, - modal: { - noResultsText: 'No results found', - resetButtonTitle: 'Reset search query', - footer: { - selectText: 'Select', - navigateText: 'Navigate', - } - } - } - }, - } - } - } + }, + }, + }, + }, + }, }, - sitemap: { - hostname: 'https://bot.liteyuki.icu' - }, - lastUpdated: true, - locales: { - root: { label: "简体中文", ...zh }, - en: { label: "English", ...en }, - }, - -}) \ No newline at end of file + }, + sitemap: { + hostname: "https://bot.liteyuki.icu", + }, + lastUpdated: true, + locales: { + root: { label: "简体中文", ...zh }, + en: { label: "English", ...en }, + }, +});