Comments (2)
That is very unfortunate.
Your example was helpful however, managed to get unpublished/draft working well.
Thanks very much.
from next-drupal.
Unfortunately the way preview works in Drupal, we cannot do preview without saving (we need an actual entity
that we can pull via JSON API).
The way we handle this right now is to enable unpublished/draft
node preview.
If you have configured a DRUPAL_CLIENT_ID
and a DRUPAL_CLIENT_SECRET
, you can use check for context.preview
in getStaticProps
and allow access.
// Return 404 if we're not in preview and is unpublished
if (!context.preview && !node?.status) {
return {
notFound: true,
}
}
// Continue if node is unpublished but we're in preview mode.
Let me know if this helps. If not, I'll try to put together a better example.
from next-drupal.
Related Issues (20)
- Add tests for esm/cjs builds HOT 1
- Request for Next-Drupal Roadmap for Upcoming Major/Minor Release HOT 2
- The documentation for the GraphQL starter should be updated to reflect the latest changes to the Drupal module dependencies. HOT 1
- NextEntityTypeConfig does not calculate dependencies
- Upgrade starters to App Router HOT 8
- Viewing a node when Next.js site doesn't have preview URL configured throws an exception HOT 2
- "403 Forbidden" Jest tests are failing HOT 1
- Document how to patch the module from pull requests HOT 2
- Organize Jest tests by method
- Add tooling to test code coverage
- Preview with accessToken from next-auth HOT 1
- Is Turbopack supported ? HOT 4
- Use `url` form element on Next.js site forms
- NextSiteEntityController::environmentVariables consumer route should not be hardcoded
- To have a method or some helper to get the user access token from drupal
- Manage releases of starters HOT 3
- getResourceFromContext doesn't appear to respect per-method auth options during preview mode
- Use live URL for preview when viewing published node HOT 1
- Remove scope from preview URL generation and validation process HOT 1
- Too many Tokens call HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-drupal.