Skip to content

Commit 123b6b3

Browse files
committed
Fix anchors again
1 parent e017d16 commit 123b6b3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/components/Page/Page.jsx

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

26+
let indexAnchors = [];
27+
if (section.name !== '/') {
28+
console.log(section.name);
29+
indexAnchors = require('page-loader!../../content/'+section.name+'/index.md').attributes.anchors;
30+
}
31+
2632
return (
2733
<Container className="page">
2834
<Sponsors />
@@ -32,7 +38,7 @@ const Page = ({ page, section }) => {
3238
sectionName={ section.name }
3339
pages={ pages }
3440
currentPage={ page.url.replace('/index', '') }
35-
anchors={ page.file.attributes.anchors } />
41+
indexAnchors={ indexAnchors } />
3642

3743
<section className="page__content">
3844
<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)