@uniweb/core 0.1.14 → 0.1.15
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 +1 -1
- package/src/website.js +14 -2
package/package.json
CHANGED
package/src/website.js
CHANGED
|
@@ -25,7 +25,7 @@ const LOCALE_NAMES = {
|
|
|
25
25
|
|
|
26
26
|
export default class Website {
|
|
27
27
|
constructor(websiteData) {
|
|
28
|
-
const { pages = [], theme = {}, config = {}, header, footer, left, right } = websiteData
|
|
28
|
+
const { pages = [], theme = {}, config = {}, header, footer, left, right, notFound } = websiteData
|
|
29
29
|
|
|
30
30
|
// Site metadata
|
|
31
31
|
this.name = config.name || ''
|
|
@@ -40,8 +40,12 @@ export default class Website {
|
|
|
40
40
|
this.leftPage = left || pages.find((p) => p.route === '/@left') || null
|
|
41
41
|
this.rightPage = right || pages.find((p) => p.route === '/@right') || null
|
|
42
42
|
|
|
43
|
+
// Store 404 page (for SPA routing)
|
|
44
|
+
// Convention: pages/404/ directory
|
|
45
|
+
this.notFoundPage = notFound || pages.find((p) => p.route === '/404') || null
|
|
46
|
+
|
|
43
47
|
// Filter out special pages from regular pages array
|
|
44
|
-
const specialRoutes = ['/@header', '/@footer', '/@left', '/@right']
|
|
48
|
+
const specialRoutes = ['/@header', '/@footer', '/@left', '/@right', '/404']
|
|
45
49
|
const regularPages = pages.filter((page) => !specialRoutes.includes(page.route))
|
|
46
50
|
|
|
47
51
|
// Store original page data for dynamic pages (needed to create instances on-demand)
|
|
@@ -769,6 +773,14 @@ export default class Website {
|
|
|
769
773
|
return this.getPageHierarchy({ nested: false, includeHidden })
|
|
770
774
|
}
|
|
771
775
|
|
|
776
|
+
/**
|
|
777
|
+
* Get the 404 (not found) page if defined
|
|
778
|
+
* @returns {Page|null} The 404 page or null
|
|
779
|
+
*/
|
|
780
|
+
getNotFoundPage() {
|
|
781
|
+
return this.notFoundPage
|
|
782
|
+
}
|
|
783
|
+
|
|
772
784
|
// ─────────────────────────────────────────────────────────────────
|
|
773
785
|
// Active Route API (for navigation components)
|
|
774
786
|
// ─────────────────────────────────────────────────────────────────
|