Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
"versions": [
{
"name": "master",
"display_name": "最新版本",
"display_name": "latest",
"branch": "master",
"url_path": "latest",
"description": "最新开发版本"
},
{
"name": "1.0.0",
"display_name": "1.0.0",
"branch": "1.0.0",
"url_path": "1.0.0",
"description": "1.0.0开发版本"
}
],
"default_version": "master",
Expand Down
49 changes: 7 additions & 42 deletions docs/source/_static/version_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,14 @@
let config = null;
let configPath = '';

if (isLocalFileSystem) {
// 本地文件系统:优先使用嵌入的版本配置
console.log('本地文件系统,使用嵌入的版本配置');
const embeddedConfig = getEmbeddedVersionConfig();
if (embeddedConfig) {
config = embeddedConfig;
configPath = 'embedded';
console.log('使用嵌入的版本配置');
} else {
console.log('嵌入配置不可用,尝试其他方法');
}
console.log('本地文件系统,使用嵌入的版本配置');
const embeddedConfig = getEmbeddedVersionConfig();
if (embeddedConfig) {
config = embeddedConfig;
configPath = 'embedded';
console.log('使用嵌入的版本配置');
} else {
// 网络环境:尝试加载配置文件
const possiblePaths = [
// 当前版本的配置文件(优先)
'./_static/version_config.json',
'_static/version_config.json',
'/_static/version_config.json',
'../_static/version_config.json',
'../../_static/version_config.json',

// 根目录通用配置文件(备选)
'../version_config.json',
'../../version_config.json',
'/version_config.json',
'./version_config.json',
'version_config.json'
];

for (const path of possiblePaths) {
try {
console.log('尝试加载配置文件:', path);
const response = await fetch(path);
if (response.ok) {
config = await response.json();
configPath = path;
console.log('成功加载配置文件:', path);
break;
}
} catch (e) {
console.log('路径失败:', path, e.message);
}
}
console.log('嵌入配置不可用,尝试其他方法');
}

// 如果仍然没有配置,使用嵌入的配置作为兜底
Expand Down
2 changes: 1 addition & 1 deletion docs/source/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project:
author: "kurisaw"
copyright: "Copyright (c) 2006-2025, RT-Thread Development Team"
# language: "zh_CN" # 注释掉固定语言配置,支持中英文双语
website: "https://www.rt-thread.org"
website: "www.rt-thread.org"

# 仓库配置
repository:
Expand Down
4 changes: 1 addition & 3 deletions docs/source/version_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ def load_versions():
"""从 versions.json 文件加载版本列表"""
# 尝试多个可能的路径
possible_paths = [
Path("../.github/versions.json"), # 从根目录运行
Path("../../.github/versions.json"), # 从docs/source运行
Path(".github/versions.json"), # 从项目根目录运行
Path("../../.github/versions.json") # 从docs/source运行
]

versions_file = None
Expand Down
Loading