From 5c61194a3bc1c036cc06cf10544a4792424affe5 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Mon, 6 Nov 2023 02:26:03 +0100 Subject: [PATCH 1/4] moving forward just a bit --- gatsby-node.js | 13 +- src/components/header/header.jsx | 16 +- src/pages/customize-build/index.js | 11 -- src/templates/apidoc.jsx | 13 +- src/tsdocs/README.md | 255 ----------------------------- 5 files changed, 20 insertions(+), 288 deletions(-) delete mode 100644 src/pages/customize-build/index.js delete mode 100644 src/tsdocs/README.md diff --git a/gatsby-node.js b/gatsby-node.js index 743d1bd3..41ed1b04 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -74,11 +74,18 @@ exports.onCreateNode = ({ node, getNode, actions }) => { trailingSlash: false, }); /* basePath -- path inside src folder to act as base path */ + const title = slug.split('/').join(' '); + createNodeField({ node, name: 'slug', value: `/apidocs${slug.replace(/ +/g, '-').replace(/-+/g, '-')}.md`, }); + createNodeField({ + node, + name: 'title', + value: title, + }); } }; @@ -267,7 +274,7 @@ exports.createPages = async ({ graphql, actions }) => { allApidocPagesMD: allMarkdownRemark( filter: { fileAbsolutePath: { - regex: "//tsdocs/[a-zA-Z0-9-]+/[a-zA-Z0-9-.]+.md/" + regex: "//tsdocs/[a-zA-Z0-9-]+[/[a-zA-Z0-9-.]+]*.md/" } } ) { @@ -275,6 +282,7 @@ exports.createPages = async ({ graphql, actions }) => { html fields { slug + title } } } @@ -287,7 +295,7 @@ exports.createPages = async ({ graphql, actions }) => { fields.slug!==null && fields.slug.trim()!=='' && docList.push({'title':frontmatter.title,'slug':fields.slug}) }) */ const apidocList = apidocPages.map(({ fields }) => ({ - title: fields.slug, + title: fields.title, slug: fields.slug, })); @@ -300,6 +308,7 @@ exports.createPages = async ({ graphql, actions }) => { component: `${path.resolve('./src/templates/apidoc.jsx')}`, context: { slug: fields.slug, + title: fields.title, prev: di === 0 ? null diff --git a/src/components/header/header.jsx b/src/components/header/header.jsx index 0e2b9552..446a31d2 100644 --- a/src/components/header/header.jsx +++ b/src/components/header/header.jsx @@ -1,8 +1,8 @@ -import React from 'react' -import { Link } from 'gatsby' -import './header.css' -import logo from '../../images/fabricjs-logo.png' -import CarbonAd from '../CarbonAd/CarbonAd' +import React from 'react'; +import { Link } from 'gatsby'; +import './header.css'; +import logo from '../../images/fabricjs-logo.png'; +import CarbonAd from '../CarbonAd/CarbonAd'; export default function Header() { return ( @@ -29,8 +29,8 @@ export default function Header() {
  • - - Customize build + + Api specs
  • @@ -49,5 +49,5 @@ export default function Header() { - ) + ); } diff --git a/src/pages/customize-build/index.js b/src/pages/customize-build/index.js deleted file mode 100644 index 0bead505..00000000 --- a/src/pages/customize-build/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react' -import Layout from '../../components/layoutFullWidth' - -// export default () =>
    Hello world!
    -export default function CustomizeBuildPage() { - return ( - -

    Customize build page

    -
    - ) -} diff --git a/src/templates/apidoc.jsx b/src/templates/apidoc.jsx index 36344f30..e286ca06 100644 --- a/src/templates/apidoc.jsx +++ b/src/templates/apidoc.jsx @@ -8,7 +8,7 @@ import PrevNextLinks from '../components/prevNextPostLinks/prevNextLinks'; export default function Apidoc({ pageContext, data }) { const { toc, mdFile, html } = data.apidocPage; - + console.log(toc.items); return ( ( @@ -16,17 +16,6 @@ export default function Apidoc({ pageContext, data }) {
    Guides