Show links to other pages in the navbar

This commit is contained in:
Alicia Sykes 2021-07-04 19:36:18 +01:00
parent b4e2c42bda
commit 9d43f013dc

View File

@ -1,7 +1,7 @@
<template>
<header>
<PageTitle v-if="titleVisible" :title="pageInfo.title" :description="pageInfo.description" />
<Nav v-if="navVisible" :links="pageInfo.navLinks" class="nav" />
<Nav v-if="navVisible" :links="getNavLinks()" class="nav" />
</header>
</template>
@ -12,6 +12,7 @@ import { visibleComponents } from '@/utils/defaults';
export default {
name: 'Header',
inject: ['config'],
components: {
PageTitle,
Nav,
@ -26,6 +27,19 @@ export default {
navVisible: visibleComponents.navigation,
};
},
methods: {
getNavLinks() {
const { appConfig } = this.config;
const pageLinks = [];
if (appConfig.additionalConfigFiles) {
appConfig.additionalConfigFiles.forEach((pageLink) => {
const name = pageLink.split('.')[0];
pageLinks.push({ title: name, path: `/home/${name}` });
});
}
return pageLinks.concat(this.pageInfo.navLinks);
},
},
};
</script>