Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!