This repository has been archived by the owner on Dec 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
566061e
commit a55931f
Showing
76 changed files
with
6,105 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
const path = require(`path`); | ||
const resolveQuickstartSlug = require("./src/utils/resolveQuickstartSlug.js"); | ||
|
||
exports.createPages = async ({ actions, graphql, reporter }) => { | ||
const { createPage } = actions; | ||
|
||
const result = await graphql(` | ||
query { | ||
allQuickstarts { | ||
edges { | ||
node { | ||
fields { | ||
slug | ||
} | ||
id | ||
} | ||
} | ||
} | ||
} | ||
`); | ||
|
||
// Handle errors | ||
if (result.errors) { | ||
reporter.panicOnBuild(`Error while running GraphQL query.`); | ||
return; | ||
} | ||
const { allQuickstarts } = result.data; | ||
|
||
allQuickstarts.edges.forEach(({ node }) => { | ||
const { | ||
fields: { slug }, | ||
id, | ||
} = node; | ||
|
||
createPage({ | ||
path: path.join(slug, "/"), | ||
component: path.resolve("./src/templates/QuickstartDetails.js"), | ||
context: { | ||
id, | ||
layout: "QuickStartLayout", | ||
}, | ||
}); | ||
}); | ||
}; | ||
|
||
exports.onCreatePage = async ({ page, actions }) => { | ||
const { createPage, deletePage } = actions; | ||
const oldPage = { ...page }; | ||
|
||
if (page.path === "/instant-observability/") { | ||
page.context.layout = "QuickStartLayout"; | ||
} | ||
deletePage(oldPage); | ||
createPage(page); | ||
}; | ||
|
||
exports.onCreateNode = ({ node, actions }) => { | ||
const { createNodeField } = actions; | ||
|
||
if (node.internal.type === "Quickstarts") { | ||
createNodeField({ | ||
node, | ||
name: "slug", | ||
value: `${resolveQuickstartSlug(node.name, node.id)}`, | ||
}); | ||
} | ||
}; | ||
|
||
exports.onCreateWebpackConfig = ({ actions, plugins }) => { | ||
actions.setWebpackConfig({ | ||
// The `debug` library is causing issues when building the site by including | ||
// invalid JS. This ensures the module resolves to the browser-capatible | ||
// source instead of the node source. See the following issue for this | ||
// recommendation: | ||
// https://github.com/escaladesports/legacy-gatsby-plugin-prefetch-google-fonts/issues/18 | ||
plugins: [plugins.normalModuleReplacement(/^\.\/node\.js/, "./browser.js")], | ||
externals: { | ||
tessen: "Tessen", | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.