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

163
Visualizações
gatsby-plugin-sitemap Putting trailing slash to homepage only

Hello Guys I am using plugin above to create a sitemap for Gatsby website, and removing forward slashes from all urls, but when I check the sitemap it is putting trailing slash to the homepage only here is the code.

serialize: ({ path }) => {
      let domain = process.env.url || 'https://example.com';
      domain =
        domain.charAt(domain.length - 1) === '/' ? domain.slice(1) : domain;
      let pathStr =
        path.charAt(path.length - 1) === '/' ? path.slice(0, -1) : path;
      let url = domain + pathStr;
      console.log(url);
      return {
        url,
        changefreq: 'daily',
        priority: 0.7
      };
    }

url is getting displayed in console, and there is no any trailing slashes, but in sitemap there is.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

With the v4.7 of Gatsby, there's a built-in option to customize the behavior of the trailing slashes across your application. It's currently in beta but should fix your issue.

trailingSlash Option Currently in Public Beta

Through the RFC Integrated handling of trailing slashes in Gatsby we’ve worked on making the trailing slashes feature a first-class citizen in Gatsby. We’re happy to announce that gatsby-config now supports a trailingSlash configuration with these three main options:

  • always: Always add trailing slashes to each URL, e.g. /x to /x/.

  • never: Remove all trailing slashes on each URL, e.g. /x/ to /x.

  • ignore: Don’t automatically modify the URL.

You can simply customize it using:

module.exports = {
  trailingSlash: "never"
}
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