@uniweb/core 0.5.17 → 0.5.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/page.js +2 -7
- package/src/website.js +7 -22
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniweb/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.19",
|
|
4
4
|
"description": "Core classes for the Uniweb platform - Uniweb, Website, Page, Block",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"jest": "^29.7.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@uniweb/semantic-parser": "1.1.
|
|
33
|
+
"@uniweb/semantic-parser": "1.1.9",
|
|
34
34
|
"@uniweb/theming": "0.1.3"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
package/src/page.js
CHANGED
|
@@ -387,13 +387,8 @@ export default class Page {
|
|
|
387
387
|
*/
|
|
388
388
|
getNavigableRoute() {
|
|
389
389
|
if (this.hasContent()) return this.route
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
// Return this folder's own route so the URL stays clean (/Articles, not /Articles/index).
|
|
393
|
-
const indexChild = children.find((c) => c.isIndex)
|
|
394
|
-
if (indexChild) return this.route
|
|
395
|
-
// Fall back to first child with content
|
|
396
|
-
for (const child of children) {
|
|
390
|
+
// Content-less containers: find first descendant with content
|
|
391
|
+
for (const child of this.children || []) {
|
|
397
392
|
const route = child.getNavigableRoute()
|
|
398
393
|
if (route) return route
|
|
399
394
|
}
|
package/src/website.js
CHANGED
|
@@ -295,13 +295,7 @@ export default class Website {
|
|
|
295
295
|
// For file-system sites whose page map uses canonical routes this will
|
|
296
296
|
// simply fall through to the reverse-translate path below.
|
|
297
297
|
const directMatch = this.pages.find((page) => page.route === normalizedStripped)
|
|
298
|
-
if (directMatch)
|
|
299
|
-
if (!directMatch.hasContent()) {
|
|
300
|
-
const indexChild = directMatch.children.find((c) => c.isIndex)
|
|
301
|
-
if (indexChild) return indexChild
|
|
302
|
-
}
|
|
303
|
-
return directMatch
|
|
304
|
-
}
|
|
298
|
+
if (directMatch) return directMatch
|
|
305
299
|
|
|
306
300
|
// Reverse-translate display route to canonical (e.g., '/acerca-de' → '/about')
|
|
307
301
|
stripped = this.reverseTranslateRoute(stripped)
|
|
@@ -312,16 +306,7 @@ export default class Website {
|
|
|
312
306
|
|
|
313
307
|
// Priority 1b: Exact match on canonical route
|
|
314
308
|
const exactMatch = this.pages.find((page) => page.route === normalizedRoute)
|
|
315
|
-
if (exactMatch)
|
|
316
|
-
// Priority 1.5: folder page with an isIndex child — resolve to the index child.
|
|
317
|
-
// This makes /Articles resolve to the /Articles/index page for rendering,
|
|
318
|
-
// keeping the URL clean while serving real content.
|
|
319
|
-
if (!exactMatch.hasContent()) {
|
|
320
|
-
const indexChild = exactMatch.children.find((c) => c.isIndex)
|
|
321
|
-
if (indexChild) return indexChild
|
|
322
|
-
}
|
|
323
|
-
return exactMatch
|
|
324
|
-
}
|
|
309
|
+
if (exactMatch) return exactMatch
|
|
325
310
|
|
|
326
311
|
// Priority 2: Index page nav route match
|
|
327
312
|
const indexMatch = this.pages.find((page) => page.isIndex && page.getNavRoute() === normalizedRoute)
|
|
@@ -945,11 +930,11 @@ export default class Website {
|
|
|
945
930
|
if (navType === 'footer' && page.hideInFooter) return false
|
|
946
931
|
}
|
|
947
932
|
|
|
948
|
-
// Skip
|
|
949
|
-
//
|
|
950
|
-
//
|
|
951
|
-
|
|
952
|
-
if (!page.hasContent() && !
|
|
933
|
+
// Skip content-less containers that have no visible children.
|
|
934
|
+
// Containers WITH visible children stay in the hierarchy as group nodes
|
|
935
|
+
// (hasContent: false) — navigation components can render them as headers
|
|
936
|
+
// or link them via navigableRoute to the first descendant with content.
|
|
937
|
+
if (!page.hasContent() && !page.children?.some(isPageVisible)) return false
|
|
953
938
|
|
|
954
939
|
// Apply custom filter if provided
|
|
955
940
|
if (customFilter && !customFilter(page)) return false
|