文档更改Home
由 Yang Sheng 于 2025-02-42,18:57 最后修改
摘要
-
页面属性 (1 修改, 0 新增, 0 删除)
细节
- 页面属性
-
- 内容
-
... ... @@ -49,7 +49,6 @@ 49 49 50 50 51 51 ))) 52 - 53 53 {{velocity}} 54 54 ## 检查当前用户是否是访客 55 55 #if($xcontext.user == 'XWiki.XWikiGuest') ... ... @@ -64,36 +64,31 @@ 64 64 #set($query = $query.setLimit(5)) 65 65 #set($recentDocs = $query.execute()) 66 66 67 - ----66 + 68 68 ==== $topPage ==== 69 69 #if($recentDocs.size() > 0) 70 70 #foreach($docFullName in $recentDocs) 71 71 #set($document = $xwiki.getDocument($docFullName)) 72 72 73 - ## 获取标题 74 74 #set($title = $document.getTitle()) 75 75 #if($title == '' || $title == $null) 76 76 #set($title = $document.getName()) 77 77 #end 78 - 79 - ## 获取路径并解析为显示格式 80 - #set($pathParts = $docFullName.split("\\.")) ## 分割路径 81 - #set($displayPath = "") 76 + 77 + #set($pathParts = $docFullName.split("\\.")) 78 + #set($trimmedPath = "") 82 82 #if($pathParts.size() > 2) 83 - ## 从二级页面开始拼接路径 84 - #set($displayPath = $pathParts[1]) 85 - #foreach($part in $pathParts.subList(2, $pathParts.size())) 86 - #set($displayPath = "${displayPath}.${part}") 87 - #end 80 + #set($trimmedPath = $pathParts.subList(1, $pathParts.size()).join(".")) 81 + #else 82 + #set($trimmedPath = $title) 88 88 #end 89 89 90 - ## 确保显示路径加上标题 91 - * [[${displayPath}>>${document.getExternalURL('view')}]] (最后更新: $datetool.format("yyyy-MM-dd HH:mm", $document.getDate())) 85 + * [[${trimmedPath}>>${document.getExternalURL('view')}]] (最后更新: $datetool.format("yyyy-MM-dd HH:mm", $document.getDate())) 92 92 #end 93 93 #else 94 94 **此分类暂无内容** 95 95 #end 96 - ----90 + 97 97 #end 98 98 #end 99 99 {{/velocity}}