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

Feature: Route read-the-docs modules

This commit is contained in:
Akshay 2021-05-24 17:11:41 +02:00
parent 697afaa0f3
commit 5ef62e7581
3 changed files with 7 additions and 17 deletions

View File

@ -99,7 +99,6 @@ module.exports = {
}
}
},
'gatsby-remark-copy-linked-files',
{
resolve: 'gatsby-remark-component',
options: {
@ -157,7 +156,7 @@ module.exports = {
name: 'repo-read-the-docs',
remote: `https://github.com/oceanprotocol/readthedocs.git`,
local: 'markdowns/',
branch: 'main',
branch: 'feature/include-readmes',
patterns: [
'markdowns/ocean-py',
'markdowns/aquarius',

View File

@ -68,6 +68,7 @@ exports.createPages = ({ graphql, actions }) => {
htmlAst
tableOfContents
frontmatter {
slug
source
title
app
@ -291,27 +292,16 @@ const createReadTheDocsPage = async (createPage, name, list) => {
)
createPage({
path: `/read-the-docs/${name}`,
matchPath: `/read-the-docs/${name}/*`,
component: markdownListTemplate,
context: {
markdownList: list,
name: name
name: name,
baseUrl: `/read-the-docs/${name}`
}
})
// list.forEach((element) => {
// createMarkdownPage(createPage, element)
// })
}
// const createMarkdownPage = async (createPage, element) => {
// // console.log("element", JSON.stringify(element.node.frontmatter))
// const markdownTemplate = path.resolve('./src/templates/MarkdownTemplate.jsx')
// createPage({
// path: element.node.frontmatter.slug,
// component: markdownTemplate
// })
// }
const filterMarkdownList = (markdownList, string) => {
return markdownList.filter(({ node }) => node.frontmatter.app === string)
}

View File

@ -7,8 +7,8 @@ import styles from '../../templates/Doc.module.scss'
import MarkdownTemplate from '../MarkdownTemplate'
import sidebarStyles from '../../components/Sidebar.module.scss'
import moduleStyles from './Markdown.module.scss'
import { generatedNestedObject } from './utils'
import { navigate } from 'gatsby'
export default function MarkdownList({ pageContext }) {
const flattenedModules = {}
@ -38,6 +38,7 @@ export default function MarkdownList({ pageContext }) {
})
setSelectedModule(found.node)
navigate(pageContext.baseUrl + '/' + found.node.frontmatter.slug)
}
const generateModuleListElement = (id, label) => {