Skip to content

Add starter template for content-js-sdk in Next.js #88

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

szymonuryga
Copy link

Added Next.js Template with content-js-sdk Integration

This PR introduces a fully configured Next.js 15 template designed to work seamlessly with the @episerver/content-js-sdk package. The template is currently available on Vercel Templates, and a free course explaining how to build it step-by-step is available at: opti-masterclass.vercel.app.


🚀 Template Features (from uryga-template branch)

  • Next.js 15 with App Router
  • Static Site Generation (SSG) for optimal performance
  • On-Demand Revalidation via webhooks for real-time content updates
  • Draft Mode for content previews
  • SEO Optimized with full metadata support
  • Multi-language Support with automatic language detection
  • Tailwind CSS and shadcn/ui for responsive, modern UI
  • TypeScript for full type safety and developer experience

📦 Included Content: uryga-template.episerverdata

This template includes a uryga-template.episerverdata file located in the root of the project, which contains all initial content for Optimizely SaaS CMS.

To import it into your Optimizely instance:

  1. Log in to your Optimizely SaaS CMS.
  2. Important: Add the "Polish" language in your CMS settings before importing.
  3. Navigate to: Admin > Tools > Import Data.
  4. Upload the uryga-template.episerverdata file from the root folder.
  5. Follow the import wizard to complete setup.

🔐 Required Environment Variables

Make sure to set the following environment variables in your project:

OPTIMIZELY_GRAPH_URL=https://cg.optimizely.com/content/v2
OPTIMIZELY_GRAPH_SINGLE_KEY=<your-content-graph-api-key>

OPTIMIZELY_CMS_CLIENT_ID=<your-cms-client-id>
OPTIMIZELY_CMS_CLIENT_SECRET=<your-cms-client-secret>

OPTIMIZELY_REVALIDATE_SECRET=<your-custom-revalidate-secret>

OPTIMIZELY_START_PAGE_URL=/start-page
OPTIMIZELY_CMS_HOST=<your-saas-cms-instance-url>

Note: OPTIMIZELY_START_PAGE_URL must explicitly define the route to your Start Page. Optimizely CMS does not automatically route / to the Start Page when using hierarchical routing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant