Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda