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

Add toc, header

This commit is contained in:
Akshay 2021-04-10 20:50:21 +02:00
parent 71efddb4e1
commit f9730213cf

View File

@ -1,12 +1,18 @@
import { graphql } from 'gatsby'
import React from 'react'
import DocToc from '../components/DocToc'
import DocHeader from '../components/DocHeader'
import DocContent from '../components/DocContent'
import Layout from '../components/Layout'
export default function MarkdownTemplate({data}) {
const post = data.markdownRemark
return (
<Layout>
<div dangerouslySetInnerHTML={{__html:post.html}}></div>
{/* <div dangerouslySetInnerHTML={{__html:post.html}}></div> */}
<DocHeader title={post.frontmatter.title}/>
{post.tableOfContents && <DocToc tableOfContents={post.tableOfContents} />}
<DocContent html={post.html} htmlAst={post.htmlAst} />
</Layout>
)
}
@ -15,10 +21,21 @@ export const postQuery = graphql`
query BlogPostByPath($path: String!) {
markdownRemark(frontmatter: { slug: { eq: $path } }) {
html
htmlAst
tableOfContents(maxDepth: 2)
frontmatter {
slug
title
}
...PageFooter
}
}
fragment PageFooter on MarkdownRemark {
parent {
... on File {
relativePath
sourceInstanceName
}
}
}
`