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

166
Visualizações
Previewing unpublished data with Next.js and Strapi

I'm working on a website that uses Next.js as a frontend and Strapi as a backend.

In Strapi I have pages and within them I have one page that is published (homepage) and another page that isn't (about); I want to be able to preview changes on the unpublished page, but as it's not published I'm getting a 404 error whenever I visit the page.

I have a [page].js dynamic route at the root of the document to grab any pages (homepage, about, ...) and display their content. It works fine if I visit example.com/homepage — I see the content no problem.

If I visit example.com/about I get a 404 error, as this page isn't published and therefore doesn't technically exist yet.

In Postman I can run a query like this:

http://example.com:1337/pages?slug=about&_publicationState=preview&published_at_null=true

And I can see the unpublished about page data. In theory then I could pass those extra flags (_publicationState, etc) to my fetch query and be able to see the unpublished data.

The problem is when I visit example.com/about this page doesn't exist so instead of loading up [page].js it's loading 404.js instead and so my query is never ran.

Hope this makes sense! I need /about to run [page].js even though it's unpublished.

about 4 years ago · Juan Pablo Isaza
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