update menu
This commit is contained in:
+33
-41
@@ -3,9 +3,16 @@ import type * as Preset from '@docusaurus/preset-classic';
|
||||
import remarkMath from 'remark-math';
|
||||
import rehypeKatex from 'rehype-katex';
|
||||
import { config as loadEnv } from 'dotenv';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
loadEnv({ path: '.env.local' });
|
||||
|
||||
const techDocsHTML = fs.readFileSync(
|
||||
path.join(__dirname, 'src/snippets/tech-docs.html'),
|
||||
'utf-8',
|
||||
);
|
||||
|
||||
const config: Config = {
|
||||
title: 'CodeDocs 编程文档',
|
||||
tagline: 'CodeDocs 编程文档 -- 这里是一些技术人的编程文档',
|
||||
@@ -35,12 +42,21 @@ const config: Config = {
|
||||
},
|
||||
|
||||
themeConfig: {
|
||||
algolia: {
|
||||
apiKey: process.env.ALGOLIA_API_KEY ?? '',
|
||||
appId: process.env.ALGOLIA_APP_ID ?? '',
|
||||
indexName: 'code-docs',
|
||||
contextualSearch: true,
|
||||
searchParameters: {},
|
||||
// Only enable Algolia when API keys are provided
|
||||
...(process.env.ALGOLIA_API_KEY && process.env.ALGOLIA_APP_ID ? {
|
||||
algolia: {
|
||||
apiKey: process.env.ALGOLIA_API_KEY,
|
||||
appId: process.env.ALGOLIA_APP_ID,
|
||||
indexName: 'code-docs',
|
||||
contextualSearch: true,
|
||||
searchParameters: {},
|
||||
},
|
||||
} : {}),
|
||||
// Enable sidebar collapse/expand button (dyte-style)
|
||||
docs: {
|
||||
sidebar: {
|
||||
hideable: true,
|
||||
},
|
||||
},
|
||||
navbar: {
|
||||
title: 'CodeDocs 编程文档',
|
||||
@@ -49,57 +65,33 @@ const config: Config = {
|
||||
src: 'img/logo.svg',
|
||||
},
|
||||
items: [
|
||||
// ── Mega Dropdown: 技术文档 (left-right panel, mirrors dyte SDK dropdown)
|
||||
{
|
||||
label: '技术文档',
|
||||
type: 'dropdown',
|
||||
label: '📚 技术文档',
|
||||
className: 'tech-docs-dropdown',
|
||||
position: 'left',
|
||||
items: [
|
||||
{
|
||||
type: 'doc',
|
||||
docId: 'backend-doc/intro-docs',
|
||||
label: '⚙️ 后端技术',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
docId: 'frontend-doc/intro-docs',
|
||||
label: '⚛️ 前端开发',
|
||||
},
|
||||
{
|
||||
type: 'doc',
|
||||
docId: 'LeetCode/intro-docs',
|
||||
label: '🧠 算法与面试',
|
||||
type: 'html',
|
||||
value: techDocsHTML,
|
||||
className: 'tech-docs-dropdown',
|
||||
},
|
||||
],
|
||||
},
|
||||
// ── Blog
|
||||
{
|
||||
type: 'dropdown',
|
||||
label: '🛠️ 工具与资源',
|
||||
to: '/blog',
|
||||
label: 'Blog',
|
||||
position: 'left',
|
||||
items: [
|
||||
{
|
||||
label: '📖 最佳实践',
|
||||
href: '#',
|
||||
},
|
||||
{
|
||||
label: '🔗 常用链接',
|
||||
href: '#',
|
||||
},
|
||||
{
|
||||
label: '📚 推荐阅读',
|
||||
href: '#',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
to: '/blog',
|
||||
label: '📝 Blog',
|
||||
position: 'left'
|
||||
},
|
||||
// ── GitHub (right)
|
||||
{
|
||||
href: 'https://github.com/chuyaoyuan/code-docs',
|
||||
label: 'GitHub',
|
||||
position: 'right',
|
||||
},
|
||||
// ── Language toggle (right)
|
||||
{
|
||||
type: 'localeDropdown',
|
||||
position: 'right',
|
||||
|
||||
Reference in New Issue
Block a user