forked from LeoLin4258/rwkvcn-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththeme.config.jsx
122 lines (117 loc) · 3.16 KB
/
theme.config.jsx
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import { useRouter } from "next/router";
import { useConfig } from "nextra-theme-docs";
import { useEffect } from 'react';
export default {
logo: <span>RWKV</span>,
project: {
link: "https://github.com/BlinkDL/RWKV-LM",
},
// ... other theme options
sidebar: {
defaultMenuCollapseLevel: 1,
autoCollapse: true,
},
search: {
placeholder: "搜索文档...",
},
feedback: {
content: null,
},
docsRepositoryBase:"https://github.com/LeoLin4258/rwkvcn-docs/blob/main",
footer: {
text: (
<div className="footer-container">
<div className="footer-left">
<span className="footer-logo">RWKV</span>
</div>
<div className="footer-right">
<p className="footer-text">© 2024 RWKV.cn. All rights reserved.</p>
<a href="https://beian.miit.gov.cn/" className="footer-link">
粤ICP备2024242518号-1
</a>
</div>
<style jsx>{`
.footer-container {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 20px;
width: 100%;
}
.footer-left {
display: flex;
align-items: center;
}
.footer-logo {
font-size: 24px;
font-weight: semi-bold;
}
.footer-right {
display: flex;
flex-direction: column;
align-items: flex-end;
text-align: right;
}
.footer-text {
margin: 0;
font-size: 14px;
color: #6c757d;
}
.footer-link {
margin-top: 5px;
font-size: 14px;
text-decoration: none;
}
@media (max-width: 768px) {
.footer-container {
flex-direction: column;
align-items: center;
text-align: center;
}
.footer-right {
align-items: center;
margin-top: 10px;
}
.footer-link {
margin-top: 5px;
}
}
`}</style>
</div>
),
},
head: () => {
const { asPath, defaultLocale, locale } = useRouter();
const { frontMatter } = useConfig();
const url =
"https://rwkv.cn" +
(defaultLocale === locale ? asPath : `/${locale}${asPath}`);
return (
<>
<meta property="og:url" content={url} />
<meta
property="keywords"
content={frontMatter.keywords || "RWKV,文档"}
/>
<meta
property="og:keywords"
content={frontMatter.keywords || "RWKV,文档"}
/>
</>
);
},
useNextSeoProps() {
useEffect(() => {
// 初始化主题
const docTheme = localStorage.getItem('docs-theme') || 'dark';
localStorage.setItem('docs-theme', docTheme);
// 初始化时设置正确的类名
document.documentElement.classList.toggle('dark', docTheme === 'dark');
document.documentElement.classList.toggle('light', docTheme === 'light');
}, []);
return {
titleTemplate: "%s ",
};
},
};