-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.html
More file actions
33 lines (32 loc) · 1.21 KB
/
main.html
File metadata and controls
33 lines (32 loc) · 1.21 KB
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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PF系列插件文档</title>
</head>
<body>
<script>
// 在页面加载时触发重定向
window.addEventListener('load', function() {
const currentPath = window.location.pathname;
const searchParams = window.location.search;
const hash = window.location.hash;
// 检查是否是 main.html
if (currentPath.endsWith('main.html')) {
// 动态获取base_url配置
import('/config.js').then(module => {
const config = module.default;
const baseUrl = config.site.base_url.replace(/\/$/, '');
const mainPath = baseUrl ? `${baseUrl}/main/` : '/main/';
window.location.href = mainPath + searchParams + hash;
});
}
// 检查其他路径是否需要添加斜杠
else if (!currentPath.endsWith('/')) {
window.location.href = currentPath + '/' + searchParams + hash;
}
});
</script>
</body>
</html>