diff --git a/gatsby-config.js b/gatsby-config.js index d8443273..0bea5e4d 100755 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -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', diff --git a/gatsby-node.js b/gatsby-node.js index 50c20dca..2d726508 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -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) } diff --git a/src/templates/Markdown/MarkdownList.jsx b/src/templates/Markdown/MarkdownList.jsx index f5ac042b..e8a7255b 100644 --- a/src/templates/Markdown/MarkdownList.jsx +++ b/src/templates/Markdown/MarkdownList.jsx @@ -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) => {