Guidance Needed: Real-World Implementation of Optimizely SaaS on Next.js

Vote:
 

Hi all,

I’m seeking advice on setting up a real-world implementation of Optimizely SaaS with Next.js. Here’s our setup:

  • Optimizely SaaS CMS for content editing.
  • Content Graph subscription to expose content.
  • Next.js rendering host to render content.

Questions:

  1. On-Page Editing Setup:

    • I’m considering using a separate Next.js editing host for CMS users to preview content and enable On-Page Editing.
    • However, I’m unsure how the editing host will fetch content. Specifically:
      • Will we require an additional Content Graph subscription?
      • If not, how can the editing host query unpublished content from Content Graph?
  2. Multisite Setup in Next.js:

    • For multisite scenarios (e.g., Mosey Bank and Music Festival demos), we currently use the getContentByPath query to fetch content from Content Graph based on the URL.
    • This approach doesn’t seem robust or scalable. Are there better alternatives for multisite content retrieval?

I’d appreciate any insights, suggestions, or best practices for addressing these challenges.

Thank you in advance!

#333591
Nov 28, 2024 23:22
Vote:
 

For on-page editing setup, there is information in the dev docs here: https://docs.developers.optimizely.com/content-management-system/v1.0.0-CMS-SaaS/docs/enable-live-preview#content-preview

Basically, for on-page editing, after configuring the CMS, your frontend (regardless of framework, and where it's hosted) loads within an iframe inside the CMS. Then there are two ways to get draft content from Graph for content preview/on-page editing:

  1. The approach in that link, using the preview_token from the preview URL -- this is the best/recommended option
  2. Basic auth, using the app key and secret to retrieve draft content (see here: https://docs.developers.optimizely.com/platform-optimizely/v1.4.0-optimizely-graph/docs/basic-auth )

In either case, that draft content is stored in the same Graph instance as the published content -- you're just modifying your query to return the draft version (or any other version, really).

#334238
Dec 12, 2024 0:44
Vote:
 

Thank you Daniel.

I have checked out the documentations and it said that it require a SPA client in order to do On Page Editing with Content Graph: (Edit on-page using Optimizely Graph)

This might not be possible with clients as they only want to maintain a single NextJS repository. We don't want to create another SPA repo just for On Page Editing.

Is there another way around this ?

#334285
Dec 13, 2024 2:44
Vote:
 

To be clear, if you're using the SaaS CMS (not the PaaS CMS), the docs link in my previous comment is the one you want to be using -- there are some slight differences to how you configure the on-page editing.

In either case, I don't think a SPA is required, just a front-end app that then gets rendered (via iframe) inside the CMS.

#334300
Dec 13, 2024 17:03
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.