How to use the gatsby-page-utils.createPath function in gatsby-page-utils

To help you get started, we’ve selected a few gatsby-page-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github karolis-sh / gatsby-mdx / packages / gatsby-transformer-mdx / utils / page-creator.js View on Github external
async create(filePath) {
    const shouldCreate = !this.pages[filePath];
    if (shouldCreate) {
      this.pages[filePath] = true;
      const componentPath = path.join(this.pagesDirectory, filePath);
      const content = await readFile(componentPath);
      const { data: frontmatter } = grayMatter(content);

      this.createPage({
        path: createPath(filePath),
        component: componentPath,
        context: frontmatter,
      });
    }
  }
github karolis-sh / gatsby-mdx / packages / gatsby-transformer-mdx / utils / page-creator.js View on Github external
this.store.getState().pages.forEach(page => {
      if (page.component === componentPath) {
        this.deletePage({
          path: createPath(filePath),
          component: componentPath,
        });
      }
    });
    this.pages[filePath] = undefined;

gatsby-page-utils

Gatsby library that helps creating pages

MIT
Latest version published 2 days ago

Package Health Score

92 / 100
Full package analysis