Changes for page Home

Last modified by Isaac Mejia on 2025/12/15 18:27

From version 10.1
edited by Isaac Mejia
on 2025/12/05 16:57
Change comment: There is no comment for this version
To version 7.2
edited by Isaac Mejia
on 2025/12/05 16:35
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,42 +1,16 @@
1 1  {{velocity}}
2 2  ## KB Home (Main.WebHome)
3 3  
4 -## ------------------------------------------------------------
5 -## 1) Discover category pages automatically
6 -## - Category pages live at: Main.<CategoryLabel>.WebHome
7 -## - We query all docs in space=Main except:
8 -## - WebHome
9 -## - KB-Categories (index page)
10 -## - KBStyles (internal style doc, not a category)
11 -## ------------------------------------------------------------
12 -#set ($xwql =
13 - "select doc.fullName, doc.title " +
14 - "from XWikiDocument doc " +
15 - "where doc.space = :space " +
16 - "and doc.name not in ('WebHome','KB-Categories','KBStyles') " +
17 - "and doc.hidden <> true " +
18 - "order by lower(doc.title)"
19 -)
4 +## Central category list:
5 +## Each entry: [ "Label", "SpaceName", "Short description" ]
6 +#set ($kbCategories = [
7 + ["Member Management", "Member Management", "How to manage members, families, and profiles."],
8 + ["Configuration", "Configuration", "Set up locations, billing, and core system settings."],
9 + ["Billing & Payments", "Billing", "Invoices, collections, and payment processing."],
10 + ["Reporting & Analytics", "Reporting", "Understand your numbers and performance."],
11 + ["Integrations", "Integrations", "Connect eFit with other tools in your stack."]
12 +])
20 20  
21 -#set ($query = $services.query.xwql($xwql).bindValue("space", "Main"))
22 -#set ($rows = $query.execute())
23 -
24 -#set ($categories = [])
25 -#foreach ($row in $rows)
26 - #set ($fullName = $row[0])
27 - #set ($catDoc = $xwiki.getDocument($fullName))
28 - #set ($discard = $categories.add($catDoc))
29 -#end
30 -
31 -## Optional description overrides (rest of your code stays the same)
32 -#set ($categoryDescriptions = {
33 - "Member Management": "How to manage members, families, and profiles.",
34 - "Configuration": "Set up locations, billing, and core system settings.",
35 - "Billing & Payments": "Invoices, collections, and payment processing.",
36 - "Reporting & Analytics": "Understand your numbers and performance.",
37 - "Integrations": "Connect eFit with other tools in your stack."
38 -})
39 -
40 40  {{html clean="false"}}
41 41  <div class="kb-home">
42 42  
... ... @@ -64,21 +64,11 @@
64 64   <h2 class="kb-section-title">Browse by category</h2>
65 65  
66 66   <div class="kb-category-grid">
67 - #foreach ($catDoc in $categories)
68 - ## Label shown on the card
69 - #set ($label = $catDoc.displayTitle) ## e.g. "Member Management"
41 + #foreach ($cat in $kbCategories)
42 + #set ($label = $cat.get(0))
43 + #set ($spaceName = $cat.get(1))
44 + #set ($desc = $cat.get(2))
70 70  
71 - ## Space/page name used in the URL path:
72 - ## uploader created category pages as Main.<Label>.WebHome,
73 - ## so doc.name is the space segment we need (with spaces).
74 - #set ($spaceName = $catDoc.name) ## e.g. "Member Management"
75 -
76 - ## Description: use override map if present, else generic
77 - #set ($desc = $categoryDescriptions.get($label))
78 - #if (!$desc)
79 - #set ($desc = "Articles and guides for " + $label)
80 - #end
81 -
82 82   ## Build clean URL: /bin/view/Main/<SpaceName> (no trailing slash)
83 83   #set ($encoded = $escapetool.url($spaceName))
84 84   #set ($cleanUrl = "/bin/view/Main/$encoded")