Skip to content

Commit acfeb17

Browse files
committed
Fix anchors again
1 parent e017d16 commit acfeb17

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/components/Page/Page.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ const Page = ({ page, section }) => {
2323
}))
2424
);
2525

26+
let indexAnchors = [];
27+
if (section.name !== '/') {
28+
indexAnchors = require('page-loader!../../content/'+section.name+'/index.md').attributes.anchors;
29+
}
30+
2631
return (
2732
<Container className="page">
2833
<Sponsors />
@@ -32,7 +37,7 @@ const Page = ({ page, section }) => {
3237
sectionName={ section.name }
3338
pages={ pages }
3439
currentPage={ page.url.replace('/index', '') }
35-
anchors={ page.file.attributes.anchors } />
40+
indexAnchors={ indexAnchors } />
3641

3742
<section className="page__content">
3843
<h1>{ title }</h1>

src/components/Sidebar/Sidebar.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default class Sidebar extends Component {
1010
};
1111

1212
render() {
13-
let { sectionName, pages, currentPage, anchors } = this.props;
13+
let { sectionName, pages, currentPage, indexAnchors } = this.props;
1414
let { fixed, availableHeight, maxWidth } = this.state;
1515

1616
return (
@@ -32,8 +32,8 @@ export default class Sidebar extends Component {
3232
<SidebarItem
3333
url={ `/${sectionName}/` }
3434
title="Introduction"
35-
currentPage= { currentPage }
36-
anchors= { anchors } />
35+
currentPage={ currentPage }
36+
anchors={ indexAnchors } />
3737

3838
{
3939
pages.map((page, i) =>

0 commit comments

Comments
 (0)