Skip to content

Commit a23acb9

Browse files
authored
Merge pull request #51 from kurisaW/master
Fix the abnormal UI of version switching
2 parents 24641d3 + 08ed8c9 commit a23acb9

File tree

4 files changed

+17
-47
lines changed

4 files changed

+17
-47
lines changed

.github/versions.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
"versions": [
33
{
44
"name": "master",
5-
"display_name": "最新版本",
5+
"display_name": "latest",
66
"branch": "master",
77
"url_path": "latest",
88
"description": "最新开发版本"
9+
},
10+
{
11+
"name": "1.0.0",
12+
"display_name": "1.0.0",
13+
"branch": "1.0.0",
14+
"url_path": "1.0.0",
15+
"description": "1.0.0开发版本"
916
}
1017
],
1118
"default_version": "master",

docs/source/_static/version_menu.js

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,14 @@
2222
let config = null;
2323
let configPath = '';
2424

25-
if (isLocalFileSystem) {
26-
// 本地文件系统:优先使用嵌入的版本配置
27-
console.log('本地文件系统,使用嵌入的版本配置');
28-
const embeddedConfig = getEmbeddedVersionConfig();
29-
if (embeddedConfig) {
30-
config = embeddedConfig;
31-
configPath = 'embedded';
32-
console.log('使用嵌入的版本配置');
33-
} else {
34-
console.log('嵌入配置不可用,尝试其他方法');
35-
}
25+
console.log('本地文件系统,使用嵌入的版本配置');
26+
const embeddedConfig = getEmbeddedVersionConfig();
27+
if (embeddedConfig) {
28+
config = embeddedConfig;
29+
configPath = 'embedded';
30+
console.log('使用嵌入的版本配置');
3631
} else {
37-
// 网络环境:尝试加载配置文件
38-
const possiblePaths = [
39-
// 当前版本的配置文件(优先)
40-
'./_static/version_config.json',
41-
'_static/version_config.json',
42-
'/_static/version_config.json',
43-
'../_static/version_config.json',
44-
'../../_static/version_config.json',
45-
46-
// 根目录通用配置文件(备选)
47-
'../version_config.json',
48-
'../../version_config.json',
49-
'/version_config.json',
50-
'./version_config.json',
51-
'version_config.json'
52-
];
53-
54-
for (const path of possiblePaths) {
55-
try {
56-
console.log('尝试加载配置文件:', path);
57-
const response = await fetch(path);
58-
if (response.ok) {
59-
config = await response.json();
60-
configPath = path;
61-
console.log('成功加载配置文件:', path);
62-
break;
63-
}
64-
} catch (e) {
65-
console.log('路径失败:', path, e.message);
66-
}
67-
}
32+
console.log('嵌入配置不可用,尝试其他方法');
6833
}
6934

7035
// 如果仍然没有配置,使用嵌入的配置作为兜底

docs/source/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ project:
88
author: "kurisaw"
99
copyright: "Copyright (c) 2006-2025, RT-Thread Development Team"
1010
# language: "zh_CN" # 注释掉固定语言配置,支持中英文双语
11-
website: "https://www.rt-thread.org"
11+
website: "www.rt-thread.org"
1212

1313
# 仓库配置
1414
repository:

docs/source/version_generator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ def load_versions():
1818
"""从 versions.json 文件加载版本列表"""
1919
# 尝试多个可能的路径
2020
possible_paths = [
21-
Path("../.github/versions.json"), # 从根目录运行
22-
Path("../../.github/versions.json"), # 从docs/source运行
23-
Path(".github/versions.json"), # 从项目根目录运行
21+
Path("../../.github/versions.json") # 从docs/source运行
2422
]
2523

2624
versions_file = None

0 commit comments

Comments
 (0)