Skip to content

Commit c20a0b1

Browse files
committed
Fix nav
1 parent 035e762 commit c20a0b1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

antwar.config.js

+12
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ module.exports = {
4444
},
4545
layout: () => require('./src/components/Page/Page.jsx').default
4646
},
47+
'api/plugins': {
48+
title: "API Plugins",
49+
content: () => require.context('./loaders/page-loader!./src/content/api/plugins', false, /^\.\/.*\.md$/),
50+
redirects: {
51+
'passing-a-config': 'configuration-types'
52+
},
53+
url: ({ sectionName, fileName }) => `/${sectionName}/${fileName}/`,
54+
transform: (pages) => {
55+
return _.sortBy(pages, (page) => page.file.sort)
56+
},
57+
layout: () => require('./src/components/Page/Page.jsx').default
58+
},
4759
pluginsapi: {
4860
title: 'API Plugin',
4961
redirects: {

src/components/Navigation/Navigation.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ export default class Navigation extends React.Component {
171171
let { pageUrl = '' } = this.props;
172172

173173
if (section.children) {
174-
return section.children.some(child => { return pageUrl == '/' + child.url + '/'; });
174+
return section.children.some(child => { return (new RegExp("^/" + child.url +".*/")).test(pageUrl); });
175175

176-
} else return pageUrl.includes('/' + section.url + '/', 0);
176+
} else return (new RegExp("^/" + section.url +".*/")).test(pageUrl);
177177
}
178178

179179
/**

0 commit comments

Comments
 (0)