generated from shuding/nextra-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paththeme.config.tsx
106 lines (95 loc) · 3.36 KB
/
theme.config.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import React from 'react';
import { DocsThemeConfig, useConfig } from 'nextra-theme-docs';
import { useRouter } from 'next/router';
import { IconFolder, IconFile} from '@tabler/icons-react';
function useHead() {
const { asPath } = useRouter();
const { frontMatter, title } = useConfig();
const iconico = "https://iceclusters.github.io/docs/static/ice-icon.ico";
const url = `https://iceclusters.github.io/docs${asPath}`;
const description = frontMatter.description || "Documentation for Ice Cluster resources";
return (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href={iconico} />
<meta httpEquiv="Content-Language" content="en" />
<meta name="description" content={description} />
<meta name="og:title" content={title} />
<meta name="og:description" content={description} />
<link rel="icon" href={iconico} id="__link-icon"></link>
<link rel="apple-touch-icon" href={iconico}></link>
<link rel="preload" as="image" href={iconico}></link>
<meta property="og:image" content="https://media.discordapp.net/attachments/1004681367214370877/1167820424290242620/iceGradientBg.jpg" />
<meta property="og:image:alt" content="Ice Cluster" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="256" />
<meta property="og:image:height" content="256"></meta>
</>
);
}
function useNextSeoProps() {
const { asPath } = useRouter();
const arr = asPath.replace(/[-_]/g, ' ').split('/');
const category = (arr[1][0] !== '#' && arr[1]) || 'Ice Cluster';
const rawTitle = arr[arr.length - 1];
const title = /[a-z]/.test(rawTitle) && /[A-Z]/.test(rawTitle) ? rawTitle : '%s';
return {
titleTemplate: `${title} - ${
rawTitle === category ? 'Documentation' : category.replace(/(^\w|\s\w)/g, (m) => m.toUpperCase())
}`,
};
}
const config: DocsThemeConfig = {
logo: (
<div
style={{
paddingLeft: '50px',
lineHeight: '38px',
background: "url('https://i.imgur.com/Rq0zGjA.png') no-repeat left",
backgroundSize: '38px',
fontWeight: 550,
}}
>
Ice Cluster
</div>
),
project: {
link: 'https://github.com/iceclusters/documentation',
},
chat: {
link: 'https://discord.gg/yGuYP7xD',
},
docsRepositoryBase: 'https://github.com/iceclusters/Documentation/blob/main',
footer: {
text: 'Ice Cluster',
},
head: useHead,
primaryHue: { dark: 190, light: 200 },
sidebar: {
defaultMenuCollapseLevel: 1,
titleComponent({ title, type, route }) {
const folderRoutes = new Set([
'/icHud',
'/icMySQL',
'/icMySQL/Benchmark',
'/icMySQL/Features',
'/icMySQL/Functions',
'/icMySQL/Functions/MySQL',
'/icMySQL/Functions/Mongo',
'/icMySQL/Functions/Redis',
'/icMySQL/Functions/ORM',
'/icTrophies',
'/icTattooShop',
]);
const isFolder = folderRoutes.has(route);
const icon = isFolder ? <IconFolder /> : <IconFile />;
return(
<>
<div className='nx-items-center nx-justify-between nx-gap-2 nx-flex nx-rounded nx-text-sm nx-transition-colors [word-break:break-word] nx-cursor-pointer'>{icon} {title}</div>
</>
)
}
},
useNextSeoProps: useNextSeoProps,
};
export default config;