Skip to content

Commit 9b33a6e

Browse files
committed
Fixes pageInfo not being read in router (#645)
1 parent 24e487c commit 9b33a6e

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/router.js

+7-16
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import { Progress } from 'rsup-progress';
1111

1212
// Import views, that are not lazy-loaded
1313
import Home from '@/views/Home.vue';
14-
import ConfigAccumulator from '@/utils/ConfigAccumalator';
1514

1615
// Import helper functions, config data and defaults
1716
import { isAuthEnabled, isLoggedIn, isGuestAccessEnabled } from '@/utils/Auth';
1817
import { makePageSlug, makePageName } from '@/utils/ConfigHelpers';
1918
import { metaTagData, startingView, routePaths } from '@/utils/defaults';
2019
import ErrorHandler from '@/utils/ErrorHandler';
2120

22-
import { pages } from '../public/conf.yml';
21+
// Import data from users conf file. Note that rebuild is required for this to update.
22+
import { pages, pageInfo, appConfig } from '../public/conf.yml';
2323

2424
Vue.use(Router);
2525
const progress = new Progress({ color: 'var(--progress-bar)' });
@@ -32,17 +32,6 @@ const isAuthenticated = () => {
3232
return (!authEnabled || userLoggedIn || guestEnabled);
3333
};
3434

35-
const getConfig = () => {
36-
const Accumulator = new ConfigAccumulator();
37-
return {
38-
appConfig: Accumulator.appConfig(),
39-
pageInfo: Accumulator.pageInfo(),
40-
pages: Accumulator.pages(),
41-
};
42-
};
43-
44-
const { appConfig, pageInfo } = getConfig();
45-
4635
/* Get the users chosen starting view from app config, or return default */
4736
const getStartingView = () => appConfig.startingView || startingView;
4837

@@ -61,7 +50,7 @@ const getStartingComponent = () => {
6150

6251
/* Returns the meta tags for each route */
6352
const makeMetaTags = (defaultTitle) => ({
64-
title: pageInfo.title || defaultTitle,
53+
title: pageInfo?.title || defaultTitle,
6554
metaTags: metaTagData,
6655
});
6756

@@ -73,10 +62,12 @@ const makeSubConfigPath = (rawPath) => {
7362

7463
/* For each additional config file, create routes for home, minimal and workspace views */
7564
const makeMultiPageRoutes = (userPages) => {
76-
if (!userPages) return [];
65+
// If no multi pages specified, or is not array, then return nothing
66+
if (!userPages || !Array.isArray(userPages)) return [];
7767
const multiPageRoutes = [];
68+
// For each user page, create an additional route
7869
userPages.forEach((page) => {
79-
if (!page.name || !page.path) {
70+
if (!page.name || !page.path) { // Sumin not right, show warning
8071
ErrorHandler('Additional pages must have both a `name` and `path`');
8172
}
8273
// Props to be passed to home mixin

0 commit comments

Comments
 (0)