1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

automatically chose sidebar based on section

This commit is contained in:
Matthias Kretschmann 2018-11-08 11:21:20 +01:00
parent cb32491139
commit 1e8cacd7f1
Signed by: m
GPG Key ID: 606EEEF3C479A91F
9 changed files with 10 additions and 13 deletions

View File

@ -1,4 +1,3 @@
---
title: Architecture
sidebar: concepts
---

View File

@ -1,4 +1,3 @@
---
title: Ecosystem
sidebar: concepts
---

View File

@ -1,6 +1,5 @@
---
title: Introduction
sidebar: concepts
---
What is Ocean Protocol?

View File

@ -1,4 +1,3 @@
---
title: Security
sidebar: concepts
---

View File

@ -1,6 +1,5 @@
---
title: Terminology
sidebar: concepts
---
There is terminology specific to Ocean Protocol.

View File

@ -1,4 +1,3 @@
---
title: Reporting vulnerabilities
sidebar: concepts
---

View File

@ -38,7 +38,7 @@ const SidebarLink = ({ link, title, linkClasses }) => {
)
}
} else {
return <>{this.props.title}</>
return title
}
}
@ -72,6 +72,7 @@ export default class Sidebar extends Component {
render() {
const { sidebar, location } = this.props
const sidebarfile = sidebar
? require(`../data/sidebars/${sidebar}.yml`) // eslint-disable-line
: []

View File

@ -0,0 +1 @@
-

View File

@ -11,14 +11,13 @@ export default class DocTemplate extends Component {
}
render() {
const { location } = this.props
const post = this.props.data.markdownRemark
const { section } = post.fields
return (
<Layout location={this.props.location}>
<Sidebar
location={this.props.location}
sidebar={post.frontmatter.sidebar}
/>
<Layout location={location}>
<Sidebar location={location} sidebar={section} />
<h1>{post.frontmatter.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.html }} />
@ -40,7 +39,9 @@ export const pageQuery = graphql`
html
frontmatter {
title
sidebar
}
fields {
section
}
}
}