0 Votes

Changes for page Incidents list

Last modified by Ryan C on 2025/07/14 15:42

From version 2.1
edited by Ryan C
on 2025/07/14 14:00
Change comment: There is no comment for this version
To version 3.1
edited by Ryan C
on 2025/07/14 14:04
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -17,16 +17,22 @@
17 17   if (obj) {
18 18   def rawHeadline = obj.getProperty('headline')?.value
19 19   def headline = (rawHeadline instanceof String) ? rawHeadline.trim() : null
20 - if (headline && headline.length() > 0) {
21 - println "* [[${headline}>>doc:${docName}]]"
22 - } else if (fallbackTitle && fallbackTitle.trim().length() > 0) {
23 - println "* [[${fallbackTitle.trim()}>>doc:${docName}]]"
20 +
21 + def rawUrl = obj.getProperty('url')?.value
22 + def url = (rawUrl instanceof String) ? rawUrl.trim() : null
23 +
24 + def isValidUrl = url?.toLowerCase()?.startsWith("http")
25 +
26 + def label = (headline && headline.length() > 0) ? headline : (fallbackTitle ?: docName)
27 +
28 + if (isValidUrl) {
29 + println "* [[${label}>>${url}]]"
24 24   } else {
25 - println "* [[${docName}>>doc:${docName}]]"
31 + println "* [[${label}>>doc:${docName}]]"
26 26   }
27 27   }
28 28   } catch (Exception e) {
29 - println "## Error reading: ${docName} -- ${e.message}"
35 + println "## Error with ${docName}: ${e.message}"
30 30   }
31 31  }
32 32  {{/groovy}}

XWiki AI Chat