@@ -11,15 +11,15 @@ import { Progress } from 'rsup-progress';
11
11
12
12
// Import views, that are not lazy-loaded
13
13
import Home from '@/views/Home.vue' ;
14
- import ConfigAccumulator from '@/utils/ConfigAccumalator' ;
15
14
16
15
// Import helper functions, config data and defaults
17
16
import { isAuthEnabled , isLoggedIn , isGuestAccessEnabled } from '@/utils/Auth' ;
18
17
import { makePageSlug , makePageName } from '@/utils/ConfigHelpers' ;
19
18
import { metaTagData , startingView , routePaths } from '@/utils/defaults' ;
20
19
import ErrorHandler from '@/utils/ErrorHandler' ;
21
20
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' ;
23
23
24
24
Vue . use ( Router ) ;
25
25
const progress = new Progress ( { color : 'var(--progress-bar)' } ) ;
@@ -32,17 +32,6 @@ const isAuthenticated = () => {
32
32
return ( ! authEnabled || userLoggedIn || guestEnabled ) ;
33
33
} ;
34
34
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
-
46
35
/* Get the users chosen starting view from app config, or return default */
47
36
const getStartingView = ( ) => appConfig . startingView || startingView ;
48
37
@@ -61,7 +50,7 @@ const getStartingComponent = () => {
61
50
62
51
/* Returns the meta tags for each route */
63
52
const makeMetaTags = ( defaultTitle ) => ( {
64
- title : pageInfo . title || defaultTitle ,
53
+ title : pageInfo ? .title || defaultTitle ,
65
54
metaTags : metaTagData ,
66
55
} ) ;
67
56
@@ -73,10 +62,12 @@ const makeSubConfigPath = (rawPath) => {
73
62
74
63
/* For each additional config file, create routes for home, minimal and workspace views */
75
64
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 [ ] ;
77
67
const multiPageRoutes = [ ] ;
68
+ // For each user page, create an additional route
78
69
userPages . forEach ( ( page ) => {
79
- if ( ! page . name || ! page . path ) {
70
+ if ( ! page . name || ! page . path ) { // Sumin not right, show warning
80
71
ErrorHandler ( 'Additional pages must have both a `name` and `path`' ) ;
81
72
}
82
73
// Props to be passed to home mixin
0 commit comments