Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Oct 13, 2023
1 parent c5022b2 commit a4a643e
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 57 deletions.
1 change: 0 additions & 1 deletion gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ module.exports = {
},
},
},
'gatsby-plugin-meta-redirect',
],
}
25 changes: 0 additions & 25 deletions gatsby-node.js

This file was deleted.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
],
"dependencies": {
"gatsby": "^4.25.7",
"gatsby-plugin-meta-redirect": "^1.1.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"theme": "^1.0.0"
Expand Down
59 changes: 29 additions & 30 deletions theme/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
const path = require('path')

module.exports = themeOptions => {
return {
plugins: [
'gatsby-plugin-styled-components',
'gatsby-plugin-react-helmet',
'gatsby-plugin-catch-links',
'gatsby-transformer-yaml',
{
resolve: 'gatsby-plugin-mdx',
options: {
extensions: ['.mdx', '.md'],
defaultLayouts: {
default: require.resolve('./src/components/layout.js'),
},
module.exports = themeOptions => ({
plugins: [
'gatsby-plugin-styled-components',
'gatsby-plugin-react-helmet',
'gatsby-plugin-catch-links',
'gatsby-transformer-yaml',
{
resolve: 'gatsby-plugin-mdx',
options: {
extensions: ['.mdx', '.md'],
defaultLayouts: {
default: require.resolve('./src/components/layout.js'),
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'content',
path: process.env.GATSBY_PARTIAL_CONTENT
? path.resolve(`./content/${process.env.GATSBY_PARTIAL_CONTENT}`)
: path.resolve('./content'),
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'content',
path: process.env.GATSBY_PARTIAL_CONTENT
? path.resolve(`./content/${process.env.GATSBY_PARTIAL_CONTENT}`)
: path.resolve('./content'),
},
{
resolve: 'gatsby-plugin-manifest',
options: {
icon: themeOptions.icon ? path.resolve(themeOptions.icon) : require.resolve('./src/images/favicon.png'),
},
},
{
resolve: 'gatsby-plugin-manifest',
options: {
icon: themeOptions.icon ? path.resolve(themeOptions.icon) : require.resolve('./src/images/favicon.png'),
},
],
}
}
},
'gatsby-plugin-meta-redirect',
],
})
25 changes: 25 additions & 0 deletions theme/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,31 @@ exports.createSchemaCustomization = ({actions: {createTypes}}) => {
`)
}

exports.onCreateNode = ({node, actions, getNode}) => {
const {createNodeField} = actions

if (node.internal.type === 'Mdx') {
const file = getNode(node.parent)

// cli paths are unchanged
if (file.relativeDirectory.startsWith('cli/')) {
return
}

// directory index paths and policy are unchanged
if (file.name === 'index' || file.relativeDirectory.match(/^policies(\/.*)?$/)) {
return
}

// otherwise, omit the directory path and use the filename as the slug
createNodeField({
name: 'slug',
node,
value: file.name,
})
}
}

exports.createPages = async ({graphql, actions}, themeOptions) => {
const repo = themeOptions.repo

Expand Down

0 comments on commit a4a643e

Please sign in to comment.