Skip to main content

Configure Content Preview

Learn how to configure content preview.


This section provides information on how to configure decoupled content preview for your site. This allows you to preview your content changes in the Next.js app before publishing to your live site.

Before You Begin

Make sure you have:

Configure Environment Variables

  1. Go to the Site Dashboard and click Builds.

  2. Scroll down to Site Environment Variables and click the Get Started or Make Changes button. The Get Started button displays if you have not added any Site Environment Variables yet.

    Site Environment Variables

    Info:
    Note

    If you have not already created a preview site within your WordPress instance, refer to the Decoupled Kit preview configuration documentation before proceeding.

  3. Add the keys below and the corresponding values and then click Save. These are the secure preview key-value pairs associated with your site. Their values can be found under the Environment Variables action in the Settings >> Pantheon Front-End Sites section of your WordPress instance. Refer to Decoupled Kit project creation documentation for more information.

    • WP_APPLICATION_USERNAME
    • WP_APPLICATION_PASSWORD
    • PREVIEW_SECRET
  4. Go to the Overview page and click the Trigger Build button to start a new build and deployment.

  5. Locate your live build in the Multidev section, click Actions, and then select View Latest Build Logs to confirm that your environment variables are set on your live Front-End Site.

  6. Log in to your WordPress dashboard.

  7. Navigate to Users and either create a new user profile or use an existing user profile. The user name is your WP_APPLICATION_USERNAME.

    Info:
    Note

    This user must have at least an Editor role. This is necessary for the user to access revisions and private posts.

  8. Hover over the user name and click Edit to open the user's profile page.

  9. Scroll down to the Application Passwords section and add your application password. Your new WP_APPLICATION_PASSWORD will display on the screen. Copy and store this value somewhere safe.

    • You now have a client that can use the preview site, however, you must configure the preview site.
  10. Navigate to Settings, select Preview Sites, and then click the ADD PREVIEW SITE button.

    Info:
    Note

    You must have the Pantheon Decoupled WordPress Preview Plugin installed and activated on your instance.

  11. Set the URL to point to http(s)://{YOUR_SITE_URL}/api/preview replacing {YOUR_SITE_URL} with the URL of your Front-End Site.

  12. Set a secret for the Preview Site and note this value down as your PREVIEW_SECRET.

You can now preview content and make other authenticated requests to your WordPress instance.