-
Notifications
You must be signed in to change notification settings - Fork 145
/
theme.config.tsx
78 lines (71 loc) · 2.17 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
import React from 'react';
import { DocsThemeConfig, useConfig } from 'nextra-theme-docs';
import { useRouter } from 'next/router';
import Search from '@components/Search';
function useHead() {
const { asPath } = useRouter();
const { frontMatter, title } = useConfig();
const url = `https://overextended.dev${asPath}`;
const description = frontMatter.description || "Documentation for Overextended's resources for FiveM/RedM";
return (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" type="image/x-icon" href="/static/ox.ico" />
<meta httpEquiv="Content-Language" content="en" />
<meta name="description" content={description} />
<meta name="og:title" content={title} />
<meta name="og:description" content={description} />
<meta name="og:url" content={url} />
</>
);
}
function useNextSeoProps() {
const { asPath } = useRouter();
const arr = asPath.replace(/[-_]/g, ' ').split('/');
const category = (arr[1][0] !== '#' && arr[1]) || 'Overextended';
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://avatars.githubusercontent.com/u/88127058?s=38') no-repeat left",
backgroundSize: '38px',
fontWeight: 550,
}}
>
Overextended
</div>
),
project: {
link: 'https://github.com/overextended/overextended.github.io',
},
chat: {
link: 'https://discord.overextended.dev',
},
docsRepositoryBase: 'https://github.com/overextended/overextended.github.io/blob/main',
footer: {
text: 'Overextended',
},
search: {
component: <Search />,
},
head: useHead,
primaryHue: { dark: 200, light: 200 },
sidebar: {
defaultMenuCollapseLevel: 1,
},
toc: {
backToTop: true,
},
useNextSeoProps: useNextSeoProps,
};
export default config;