File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 44- docsify-last-modified:新增“优先 HEAD、GitHub 备用”的策略与配置项(preferHead)
55- 同步要求:腾讯云 COS 需开启 CORS,并在 Expose Headers 中加入 ` Last-Modified `
66- 站点 Origin 建议:优先保留 ` https://www.sicnuwiki.com ` (可按需追加 ` https://sicnuwiki.com ` )
7+ - twikoo:修正 Docsify 页面 path 计算,确保不同页面评论区独立
78
89### 腾讯云 COS CORS 设置要点
910- 路径:对象存储 COS → 存储桶 → 安全管理 → 跨域访问 CORS
Original file line number Diff line number Diff line change 236236 // 调用 twikoo 评论,正则 path,刷新当前评论
237237 hook . doneEach ( function ( ) {
238238 // 获取当前 docsify 页面路径作为评论区分标识
239- var currentPath = location . hash . replace ( / ^ # / , '' ) . replace ( / \? .* $ / , '' ) || '/' ;
239+ var currentPath = decodeURIComponent ( vm . route . path || location . hash . replace ( / ^ # / , '' ) . replace ( / \? .* $ / , '' ) || '/' ) ;
240+ if ( currentPath . charAt ( 0 ) !== '/' ) {
241+ currentPath = '/' + currentPath ;
242+ }
240243
241244 // 如果路径相同,不重复初始化
242245 if ( lastPath === currentPath ) {
259262 // 延迟加载 twikoo,避免影响页面滑动性能
260263 twikooTimer = setTimeout ( function ( ) {
261264 // 再次检查路径是否仍然匹配(用户可能已切换)
262- var nowPath = location . hash . replace ( / ^ # / , '' ) . replace ( / \? .* $ / , '' ) || '/' ;
265+ var nowPath = decodeURIComponent ( vm . route . path || location . hash . replace ( / ^ # / , '' ) . replace ( / \? .* $ / , '' ) || '/' ) ;
266+ if ( nowPath . charAt ( 0 ) !== '/' ) {
267+ nowPath = '/' + nowPath ;
268+ }
263269 if ( nowPath !== currentPath ) {
264270 return ;
265271 }
You can’t perform that action at this time.
0 commit comments