forked from vercel/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update preview mode example to say draft mode (vercel#699)
### Description We're changing the name of Preview Mode to Draft mode. - [Next docs update](https://nextjs.org/docs/pages/building-your-application/configuring/draft-mode) Vercel docs updates are in the works. <!-- ✍️ Write a short summary of your work. Screenshots and videos are welcome! --> ### Demo URL <!-- Provide a URL to a live deployment where we can test your PR. If a demo isn't possible feel free to omit this section. --> ### Type of Change - [ ] New Example - [x] Example updates (Bug fixes, new features, etc.) - [ ] Other (changes to the codebase, but not to examples) ### New Example Checklist - [ ] 🛫 `npm run new-example` was used to create the example - [ ] 📚 The template wasn't used but I carefuly read the [Adding a new example](https://github.com/vercel/examples#adding-a-new-example) steps and implemented them in the example - [ ] 📱 Is it responsive? Are mobile and tablets considered? --------- Co-authored-by: Steven <[email protected]>
- Loading branch information
1 parent
542d735
commit 3712de9
Showing
10 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Draft Mode | ||
|
||
## Build Output API | ||
|
||
This Prebuilt Deployment example demonstrates how to implement "Draft Mode" when using the [Build Output API](https://vercel.com/docs/build-output-api/v3#features/draft-mode). | ||
|
||
### Demo | ||
|
||
https://build-output-api-draft-mode.vercel.sh | ||
|
||
### How it Works | ||
|
||
When using Prerender Functions, you may want to implement "Draft Mode" which would allow you to bypass the caching | ||
aspect of prerender functions, i.e. while writing draft blog posts before they are ready to be published. | ||
|
||
To implement this, the `bypassToken` of the [`<name>.prerender-config.json`](./.vercel/output/functions/index.prerender-config.json) file should be set to a randomized string that you generate at build-time. This string should not be exposed to users / the client-side, except under authenticated circumstances. | ||
|
||
To enable "Draft Mode", a cookie with the name `__prerender_bypass` needs to be set (i.e. by a Serverless Function) with the value of the `bypassToken`. When the Prerender Function endpoint is accessed while the cookie is set, then "Draft Mode" will be activated, bypassing any caching that Vercel would normally provide when not in Draft Mode. |
This file was deleted.
Oops, something went wrong.