Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static preview #2295

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Static preview #2295

wants to merge 9 commits into from

Conversation

pwizla
Copy link
Collaborator

@pwizla pwizla commented Nov 22, 2024

This PR adds docs for Static Preview (it targets the beta version, so no mention of feature flags):

Copy link

vercel bot commented Nov 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 22, 2024 4:27pm

@pwizla pwizla self-assigned this Nov 22, 2024
@pwizla pwizla added pr: new content PRs for new product features or new documentation sections source: Dev Docs PRs/issues targeting the Developer Docs source: User Guide PRs/issues targeting the User Guide labels Nov 22, 2024
@pwizla pwizla added this to the 5.3.0 milestone Nov 22, 2024
@remidej
Copy link
Contributor

remidej commented Nov 22, 2024

This is really good!

2 things about the next.js guide part:

  • with the code you suggest they'll run into the issue where they will never exit Next.js draft mode after opening it. This is the bug you encountered yesterday where you see draft content even in the published tab. You can see how I fixed in in the launchpad. Basically you need to always go through the next.js preview route, so that you can force the draft mode cookie removal when the status is published.
  • since your guide is pretty in depth already, I would add the last missing piece, which is to check if draft mode is enabled in the places that are querying Strapi data, so they can know whether they should add the status=draft param. See this part of the launchpad code for an example.

preview: {
enabled: true,
config: {
allowedOrigins: env("CLIENT_URL"), // Usually your frontend application URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the moment this should be an array, so you can specify multiple urls

Suggested change
allowedOrigins: env("CLIENT_URL"), // Usually your frontend application URL
allowedOrigins: [env("CLIENT_URL")], // Usually your frontend application URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: new content PRs for new product features or new documentation sections source: Dev Docs PRs/issues targeting the Developer Docs source: User Guide PRs/issues targeting the User Guide
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants