Skip to content

Commit

Permalink
fix routing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Dec 28, 2020
1 parent e30bbb1 commit 70e9dc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/cli/src/lifecycles/graph.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
const fs = require('fs-extra');
const fs = require('fs');
const fm = require('front-matter');
const toc = require('markdown-toc');

Expand Down Expand Up @@ -37,8 +37,8 @@ module.exports = generateGraph = async (compilation) => {
*/
if (relativePagePath.lastIndexOf('/') > 0) {
// https://github.com/ProjectEvergreen/greenwood/issues/455
route = label === 'index'
? `${route.replace('/index', '')}/`
route = label === 'index' || route.replace('/index', '') === `/${label}`
? route.replace('index', '')
: `${route}/`;
} else {
route = route === '/index'
Expand Down
3 changes: 1 addition & 2 deletions www/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class HeaderComponent extends LitElement {
.then(data => {
this.navigation = data.filter(page => {
if (page.data.menu === 'navigation') {
page.link = page.route;
page.label = `${page.label.charAt(0).toUpperCase()}${page.label.slice(1)}`.replace('-', ' ');

return page;
Expand Down Expand Up @@ -68,7 +67,7 @@ class HeaderComponent extends LitElement {
<ul>
${navigation.map((item) => {
return html`
<li><a href="${item.link}" title="Click to visit the ${item.label} page">${item.label}</a></li>
<li><a href="${item.route}" title="Click to visit the ${item.label} page">${item.label}</a></li>
`;
})}
</ul>
Expand Down

0 comments on commit 70e9dc4

Please sign in to comment.