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 title: Architecture
sidebar: concepts
--- ---

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@ const SidebarLink = ({ link, title, linkClasses }) => {
) )
} }
} else { } else {
return <>{this.props.title}</> return title
} }
} }
@ -72,6 +72,7 @@ export default class Sidebar extends Component {
render() { render() {
const { sidebar, location } = this.props const { sidebar, location } = this.props
const sidebarfile = sidebar const sidebarfile = sidebar
? require(`../data/sidebars/${sidebar}.yml`) // eslint-disable-line ? 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() { render() {
const { location } = this.props
const post = this.props.data.markdownRemark const post = this.props.data.markdownRemark
const { section } = post.fields
return ( return (
<Layout location={this.props.location}> <Layout location={location}>
<Sidebar <Sidebar location={location} sidebar={section} />
location={this.props.location}
sidebar={post.frontmatter.sidebar}
/>
<h1>{post.frontmatter.title}</h1> <h1>{post.frontmatter.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.html }} /> <div dangerouslySetInnerHTML={{ __html: post.html }} />
@ -40,7 +39,9 @@ export const pageQuery = graphql`
html html
frontmatter { frontmatter {
title title
sidebar }
fields {
section
} }
} }
} }