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:
parent
697afaa0f3
commit
5ef62e7581
@ -99,7 +99,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'gatsby-remark-copy-linked-files',
|
|
||||||
{
|
{
|
||||||
resolve: 'gatsby-remark-component',
|
resolve: 'gatsby-remark-component',
|
||||||
options: {
|
options: {
|
||||||
@ -157,7 +156,7 @@ module.exports = {
|
|||||||
name: 'repo-read-the-docs',
|
name: 'repo-read-the-docs',
|
||||||
remote: `https://github.com/oceanprotocol/readthedocs.git`,
|
remote: `https://github.com/oceanprotocol/readthedocs.git`,
|
||||||
local: 'markdowns/',
|
local: 'markdowns/',
|
||||||
branch: 'main',
|
branch: 'feature/include-readmes',
|
||||||
patterns: [
|
patterns: [
|
||||||
'markdowns/ocean-py',
|
'markdowns/ocean-py',
|
||||||
'markdowns/aquarius',
|
'markdowns/aquarius',
|
||||||
|
@ -68,6 +68,7 @@ exports.createPages = ({ graphql, actions }) => {
|
|||||||
htmlAst
|
htmlAst
|
||||||
tableOfContents
|
tableOfContents
|
||||||
frontmatter {
|
frontmatter {
|
||||||
|
slug
|
||||||
source
|
source
|
||||||
title
|
title
|
||||||
app
|
app
|
||||||
@ -291,27 +292,16 @@ const createReadTheDocsPage = async (createPage, name, list) => {
|
|||||||
)
|
)
|
||||||
createPage({
|
createPage({
|
||||||
path: `/read-the-docs/${name}`,
|
path: `/read-the-docs/${name}`,
|
||||||
|
matchPath: `/read-the-docs/${name}/*`,
|
||||||
component: markdownListTemplate,
|
component: markdownListTemplate,
|
||||||
context: {
|
context: {
|
||||||
markdownList: list,
|
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) => {
|
const filterMarkdownList = (markdownList, string) => {
|
||||||
return markdownList.filter(({ node }) => node.frontmatter.app === string)
|
return markdownList.filter(({ node }) => node.frontmatter.app === string)
|
||||||
}
|
}
|
||||||
|
@ -7,8 +7,8 @@ import styles from '../../templates/Doc.module.scss'
|
|||||||
import MarkdownTemplate from '../MarkdownTemplate'
|
import MarkdownTemplate from '../MarkdownTemplate'
|
||||||
import sidebarStyles from '../../components/Sidebar.module.scss'
|
import sidebarStyles from '../../components/Sidebar.module.scss'
|
||||||
import moduleStyles from './Markdown.module.scss'
|
import moduleStyles from './Markdown.module.scss'
|
||||||
|
|
||||||
import { generatedNestedObject } from './utils'
|
import { generatedNestedObject } from './utils'
|
||||||
|
import { navigate } from 'gatsby'
|
||||||
|
|
||||||
export default function MarkdownList({ pageContext }) {
|
export default function MarkdownList({ pageContext }) {
|
||||||
const flattenedModules = {}
|
const flattenedModules = {}
|
||||||
@ -38,6 +38,7 @@ export default function MarkdownList({ pageContext }) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
setSelectedModule(found.node)
|
setSelectedModule(found.node)
|
||||||
|
navigate(pageContext.baseUrl + '/' + found.node.frontmatter.slug)
|
||||||
}
|
}
|
||||||
|
|
||||||
const generateModuleListElement = (id, label) => {
|
const generateModuleListElement = (id, label) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user