diff --git a/src/components/PageStrcture/Nav.vue b/src/components/PageStrcture/Nav.vue index 781d776fb3..1d387de382 100644 --- a/src/components/PageStrcture/Nav.vue +++ b/src/components/PageStrcture/Nav.vue @@ -7,20 +7,20 @@ @@ -44,15 +44,22 @@ export default { isMobile: false, }), computed: { - /* Get links to sub-pages, and combine with nav-links */ + /* Build nav links: custom links + sub-pages (excluding current) + optional Home button */ allLinks() { - const subPages = this.$store.getters.pages.filter((page) => checkPageVisibility(page)) + const currentSubPageId = this.$store.state.currentConfigInfo?.confId || null; + let subPages = this.$store.getters.pages + .filter((page) => checkPageVisibility(page)) .map((subPage) => ({ path: makePageSlug(subPage.name, 'home'), title: subPage.name, + _isSubPage: true, })); + if (currentSubPageId) { + subPages = subPages.filter(p => !p.path.endsWith(`/${currentSubPageId}`)); + } const navLinks = this.links || []; - return [...navLinks, ...subPages]; + const homeButton = currentSubPageId ? [{ path: '/home/', title: 'Home', _isHome: true }] : []; + return [...navLinks, ...subPages, ...homeButton]; }, }, created() { @@ -107,6 +114,9 @@ export default { border: 1px solid var(--nav-link-border-color-hover); box-shadow: var(--nav-link-shadow-hover); } + &.home-button { + font-weight: 600; + } } } /* Mobile and Burger-Menu Styles */