Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

121
Vistas
Filtering the Gatsby Slug in onCreateNode

I'm trying to filter the slug generated by Gatsby so I can remove white space and replace it with "-". I have Gatsby's reporter set to fire when onCreateNode is ran but it never seems to fire regardless of clearing the cache first. When I check in GraphiQL it shows no change to the slug. Here is my gastby-node.js onCreateNode:

exports.onCreateNode = ({ node, getNode, actions, reporter }) => {
reporter.info(`onCreateNode called from gatsby-node`)
const { createNodeField } = actions
if (node.internal.type === `MarkdownRemark`) {
    const slug = createFilePath({ node, getNode, basePath: `posts` }).replace(
        ' ',
        '-'
    )
    createNodeField({
        node,
        name: `slug`,
        value: slug
    })
}}

Any input would be greatly appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There ended up being two instances of onCreateNode() in my gatsby-node.js file. Only one of them was being called during build. Removing the second instance of onCreateNode() solved my problem.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda