<commit_before>const path = require('path');
const {createFilePath} = require('gatsby-source-filesystem');

const pageTemplate = path.resolve(__dirname, './src/components/page.js');

exports.onCreateNode = ({node, getNode, actions}) => {
  if (node.internal.type === 'MarkdownRemark') {
    const route = createFilePath({node, getNode});
    const group = route.split('/')[1];

    actions.createNodeField({node, name: 'route', value: route});
    actions.createNodeField({node, name: 'group', value: group});
  }
};

exports.createPages = ({graphql, actions}) => {
  return new Promise((resolve, reject) => {
    graphql(
      `{
        allMarkdownRemark(limit: 1000) {
          edges {
            node {
              fields {
                route
              }
            }
          }
        }
      }`
    ).then(result => {
      if (result.errors) reject(result.errors);

      result.data.allMarkdownRemark.edges.forEach(({node}) => {
        actions.createPage({
          path: node.fields.route,
          component: pageTemplate,
          context: {}
        });<commit_msg>styleguide: allow README.md files in docs to not turn into pages<commit_after>const path = require('path');
const {createFilePath} = require('gatsby-source-filesystem');

const pageTemplate = path.resolve(__dirname, './src/components/page.js');

exports.onCreateNode = ({node, getNode, actions}) => {
  if (node.internal.type === 'MarkdownRemark') {
    const route = createFilePath({node, getNode});
    const group = route.split('/')[1];
    const isReadme = /\/readme.md/i.test(node.fileAbsolutePath);

    actions.createNodeField({node, name: 'route', value: route});
    actions.createNodeField({node, name: 'group', value: group});
    actions.createNodeField({node, name: 'isReadme', value: isReadme});
  }
};

exports.createPages = ({graphql, actions}) => {
  return new Promise((resolve, reject) => {
    graphql(
      `{
        allMarkdownRemark(limit: 1000) {
          edges {
            node {
              fields {
                route
                isReadme
              }
            }
          }
        }
      }`
    ).then(result => {
      if (result.errors) reject(result.errors);

      result.data.allMarkdownRemark.edges.forEach(({node}) => {
        if (node.fields.isReadme) return;

        actions.createPage({
          path: node.fields.route,
          component: pageTemplate,
          context: {}
        });
{'fraction_non_alphanumeric': 0.1511437908496732, 'fraction_numerical': 0.004084967320261438, 'mean_word_length': 2.401388888888889, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4007367', 'n_tokens_mistral': 726, 'n_tokens_neox': 709, 'n_words': 140}