Fetch the repository succeeded.
'use strict'
/*
* Implement Gatsby's Node APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/node-apis/
*/
const fs = require('fs')
const yaml = require('js-yaml')
const envFlag = require('node-env-flag')
const includeDevPages = envFlag(process.env.INCLUDE_DEV_PAGES, true)
const { categories } = yaml.load(
fs.readFileSync('./service-definitions.yml', 'utf8')
)
// Often in Gatsby context gets piped through GraphQL, but GraphQL adds
// unnecessary complexity here, so this uses the programmatic API.
// https://www.gatsbyjs.org/docs/using-gatsby-without-graphql/#the-approach-fetch-data-and-use-gatsbys-createpages-api
async function createPages({ actions: { createPage } }) {
if (includeDevPages) {
createPage({
path: '/dev/styles',
component: require.resolve(
'./frontend/components/development/style-page.tsx'
),
})
createPage({
path: '/dev/logos',
component: require.resolve(
'./frontend/components/development/logo-page.tsx'
),
})
}
categories.forEach(category => {
const { id } = category
createPage({
path: `/category/${id}`,
component: require.resolve('./frontend/components/main.tsx'),
// `context` provided here becomes `props.pageContext` on the page.
context: { category },
})
})
}
module.exports = { createPages }
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。