fix: 文档版本切换使用绝对路径#928
Open
yunye-ygx wants to merge 1 commit into
Open
Conversation
- 为版本选择下拉菜单中的链接添加了缺失的前导斜杠 - 确保版本跳转路径正确,避免页面跳转错误 - 保持文档结构和样式未变,提高用户访问体验
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修改内容
将文档版本切换下拉框中的相对路径改为绝对路径。
例如:
doc.html改为/doc.htmlv/v1.44.0/doc.html改为/v/v1.44.0/doc.html问题原因
当前版本切换使用的是相对路径。
当页面位于类似
/v/v1.43.0/doc.html这样的路径下时,如果继续切换到其他旧版本,浏览器会基于当前目录拼接地址,
从而生成错误路径,例如:
/v/v1.43.0/v/v1.42.0/doc.html这会导致页面 404。
修复效果
改为绝对路径后,版本切换会从站点根路径开始解析,
不再因为当前页面目录层级不同而拼接出错误地址。
补充说明:测试时发现,进入旧版本页面后,点击下拉框中的“最新版”不能正确跳回最新版页面。这个问题会影响版本切换体验。
本次 PR 仅修复当前文档模板中的版本切换路径问题,不包含历史版本静态页面的统一修复。