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

96
Visualizações
Get a list of all pages from `docs` directory?

I am trying to implement a "Get random page" link in Docusaurus. For that I would like to get a list of all available pages/page ids+path from the docs/ directory.

Does Docusaurus have a way to do this programmatically?

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

0

I did not find any native or plugin way to achieve this... Here is how I you do it:


PART 1

Once you built you docusaurus website, will be generated a sitemap.xml file. This file is locate at the root directory of your site and contains all of the url of the doc pages.

Create a js function that read this file and parse it. Then get a random url open it.

TIP 1: https://www.w3schools.com/xml/xml_parser.asp

TIP 2: https://www.w3schools.com/jsref/met_win_open.asp


PART 2

Then, you can embed your JavaScript using the mdx function of docusaurus.

TIP: How can I add custom scripts in index.html's head part in Docusaurus V2?

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