Files
code-docs/docusaurus.config.ts
T
2026-04-29 19:03:25 +08:00

152 lines
3.4 KiB
TypeScript

import type { Config } from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
const config: Config = {
title: 'CodeDocs 编程文档',
tagline: 'CodeDocs 编程文档 -- 这里是一些技术人的编程文档',
url: 'http://docs.yaoyuan.io/',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.ico',
organizationName: 'chuyaoyuan',
projectName: 'code-docs',
i18n: {
defaultLocale: 'zh-cn',
locales: ['zh-cn', 'en'],
localeConfigs: {
'zh-cn': {
label: '中文',
direction: 'ltr',
htmlLang: 'zh-CN',
},
en: {
label: 'English',
direction: 'ltr',
htmlLang: 'en-US',
},
},
},
themeConfig: {
algolia: {
apiKey: process.env.ALGOLIA_API_KEY ?? '',
appId: process.env.ALGOLIA_APP_ID ?? '',
indexName: 'code-docs',
contextualSearch: true,
searchParameters: {},
},
navbar: {
title: 'CodeDocs 编程文档',
logo: {
alt: 'CodeDocs 编程文档',
src: 'img/logo.svg',
},
items: [
{
type: 'doc',
docId: 'intro-docs',
position: 'left',
label: 'Docs',
},
{ to: '/blog', label: 'Blog', position: 'left' },
{
href: 'https://github.com/chuyaoyuan/code-docs',
label: 'GitHub',
position: 'right',
},
{
type: 'localeDropdown',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: '文档',
items: [
{
label: 'CodeDocs',
to: '/docs/intro-docs',
},
],
},
{
title: '第三方链接',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/',
},
{
label: 'Discord',
href: 'https://discordapp.com/',
},
],
},
{
title: '开发团队',
items: [
{
label: 'chuyaoyuan',
href: 'https://github.com/chuyaoyuan/',
},
{
label: 'zhangbohou',
href: 'https://github.com/BohouZhang',
},
],
},
{
title: '更多',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/chuyaoyuan/code-docs',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} Code Docs, Inc. 一些技术人的编程文档网站.`,
},
} satisfies Preset.ThemeConfig,
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css',
type: 'text/css',
crossorigin: 'anonymous',
},
],
presets: [
[
'classic',
{
docs: {
sidebarPath: './sidebars.ts',
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
blog: {
showReadingTime: true,
},
theme: {
customCss: './src/css/custom.css',
},
} satisfies Preset.Options,
],
],
};
export default config;