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:
parent
cb32491139
commit
1e8cacd7f1
@ -1,4 +1,3 @@
|
||||
---
|
||||
title: Architecture
|
||||
sidebar: concepts
|
||||
---
|
||||
|
@ -1,4 +1,3 @@
|
||||
---
|
||||
title: Ecosystem
|
||||
sidebar: concepts
|
||||
---
|
||||
|
@ -1,6 +1,5 @@
|
||||
---
|
||||
title: Introduction
|
||||
sidebar: concepts
|
||||
---
|
||||
|
||||
What is Ocean Protocol?
|
||||
|
@ -1,4 +1,3 @@
|
||||
---
|
||||
title: Security
|
||||
sidebar: concepts
|
||||
---
|
||||
|
@ -1,6 +1,5 @@
|
||||
---
|
||||
title: Terminology
|
||||
sidebar: concepts
|
||||
---
|
||||
|
||||
There is terminology specific to Ocean Protocol.
|
||||
|
@ -1,4 +1,3 @@
|
||||
---
|
||||
title: Reporting vulnerabilities
|
||||
sidebar: concepts
|
||||
---
|
||||
|
@ -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
|
||||
: []
|
||||
|
@ -0,0 +1 @@
|
||||
-
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user