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