PHP 8.2.30
Preview: gatsby-node.js Size: 974 B
/opt/alt/alt-nodejs12/root/usr/lib/node_modules/npm/docs/gatsby-node.js

const {createFilePath} = require('gatsby-source-filesystem')
const path = require('path')

exports.onCreateNode = ({node, getNode, actions}) => {
  const {createNodeField} = actions
  if (node.internal.type === 'MarkdownRemark') {
    const slug = createFilePath({node, getNode, basePath: 'content', trailingSlash: false})
    createNodeField({
      node,
      name: 'slug',
      value: slug
    })
  }
}

exports.createPages = ({graphql, actions}) => {
  const {createPage} = actions
  return graphql(`
    {
      allMarkdownRemark {
        edges {
          node {
            id
            fields {
              slug
            }
            html
          }
        }
      }
    }
  `).then(result => {
    result.data.allMarkdownRemark.edges.forEach(({node}) => {
      createPage({
        path: node.fields.slug,
        component: path.resolve('./src/templates/Page.js'),
        context: {
          slug: node.fields.slug
        }
      })
    })
  })
}

Directory Contents

Dirs: 3 × Files: 7

Name Size Perms Modified Actions
content DIR
- drwxr-xr-x 2026-03-09 07:28:36
Edit Download
public DIR
- drwxr-xr-x 2026-03-19 07:09:41
Edit Download
src DIR
- drwxr-xr-x 2026-03-19 07:09:41
Edit Download
250 B lrw-r--r-- 2026-03-09 07:21:28
Edit Download
2.62 KB lrw-r--r-- 2026-03-09 07:21:28
Edit Download
974 B lrw-r--r-- 2026-03-09 07:21:28
Edit Download
179 B lrw-r--r-- 2026-03-09 07:21:28
Edit Download
1.05 KB lrw-r--r-- 2026-03-09 07:21:28
Edit Download
716.78 KB lrw-r--r-- 2026-03-09 07:21:28
Edit Download
1.39 KB lrw-r--r-- 2026-03-09 07:21:28
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).