From 3e06fac3e7e2638f728429eb581a48132e78a7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Garc=C3=ADa=20Garc=C3=ADa?= Date: Wed, 20 Sep 2023 14:56:27 +0200 Subject: [PATCH] Fix Sidebar in undefined routes --- src/.vuepress/theme/layouts/Layout.vue | 31 +++++++++++++++++--------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/.vuepress/theme/layouts/Layout.vue b/src/.vuepress/theme/layouts/Layout.vue index 93bbda7c9..d0f7ac546 100644 --- a/src/.vuepress/theme/layouts/Layout.vue +++ b/src/.vuepress/theme/layouts/Layout.vue @@ -36,6 +36,12 @@ export default { return { isSidebarOpen: false, previousPageUrl: null, + undeclaredRoutes: [ + "pupil-cloud", + "enrichments", + "export-formats", + "visualizations", + ], }; }, @@ -53,8 +59,9 @@ export default { /* Fail safe, previousPage will be null if coming from external source, thus load neon for enrichments and export formats*/ if (this.previousPageUrl === null) { if ( - this.$page.regularPath.includes("enrichments") || - this.$page.regularPath.includes("export-formats") + this.undeclaredRoutes.some((item) => + this.$page.regularPath.includes(item) + ) ) { this.previousPageUrl = "/neon/"; } else { @@ -89,20 +96,23 @@ export default { /* This part here checks from which page comes from and sets the previous url accordingly.*/ if (from.path.includes("invisible")) { if ( - this.$page.regularPath.includes("enrichments") || - this.$page.regularPath.includes("export-formats") + this.undeclaredRoutes.some((item) => + this.$page.regularPath.includes(item) + ) ) { this.previousPageUrl = "/invisible/"; } else { this.previousPageUrl = to.path; } } else if ( - from.path.includes("enrichments") || - from.path.includes("export-formats") + this.undeclaredRoutes.some((item) => + this.$page.regularPath.includes(item) + ) ) { if ( - this.$page.regularPath.includes("enrichments") || - this.$page.regularPath.includes("export-formats") + this.undeclaredRoutes.some((item) => + this.$page.regularPath.includes(item) + ) ) { this.previousPageUrl = from.$page.previousPageUrl; } else { @@ -110,8 +120,9 @@ export default { } } else { if ( - this.$page.regularPath.includes("enrichments") || - this.$page.regularPath.includes("export-formats") + this.undeclaredRoutes.some((item) => + this.$page.regularPath.includes(item) + ) ) { this.previousPageUrl = "/neon/"; } else {