Skip to content

Conversation

@TRomesh
Copy link
Contributor

@TRomesh TRomesh commented Oct 16, 2025

This template is 75% complete. The remaining features can be implemented once the tasks in CMS-46339 are resolved.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new alloy-template to the templates directory, providing a Next.js-based starter template for Optimizely CMS projects. The template includes pre-configured components, TypeScript configuration, and Tailwind CSS styling.

  • Adds a complete Next.js 15.5.4 template with React 19.1.0
  • Includes various reusable CMS components (Teaser, Notice, Contact, etc.)
  • Configures TypeScript, Tailwind CSS v4, and PostCSS
  • Updates workspace configuration to include the templates directory

Reviewed Changes

Copilot reviewed 28 out of 36 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
templates/alloy-template/package.json Defines project dependencies including Next.js, React 19, and Tailwind CSS v4
templates/alloy-template/tsconfig.json TypeScript configuration with Next.js and bundler module resolution
templates/alloy-template/src/components/*.tsx Component files for Teaser, Notice, Contact, Editorial, Article, and other CMS content types
templates/alloy-template/src/components/Start.tsx Start page component with composition support
templates/alloy-template/src/app/*.tsx Next.js app router pages including layout, dynamic routes, and preview
templates/alloy-template/next.config.ts Next.js configuration for remote image patterns
pnpm-workspace.yaml Updated to include templates directory in workspace
pnpm-lock.yaml Lock file updated with new template dependencies
Files not reviewed (2)
  • pnpm-lock.yaml: Language not supported
  • templates/alloy-template/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CLAassistant
Copy link

CLAassistant commented Nov 11, 2025

CLA assistant check
All committers have signed the CLA.

@TRomesh TRomesh requested a review from Copilot November 11, 2025 07:56
Copilot finished reviewing on behalf of TRomesh November 11, 2025 07:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 28 out of 36 changed files in this pull request and generated 5 comments.

Files not reviewed (2)
  • pnpm-lock.yaml: Language not supported
  • templates/alloy-template/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@exacs exacs left a comment

Choose a reason for hiding this comment

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

Overall the code looks good to me!


const nextConfig: NextConfig = {
images: {
domains: ['app-opinjssdk1sob7t001.cms.optimizely.com'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be an env variable?

Comment on lines +11 to +13
type: 'url',
displayName: 'Button Link',
group: 'Information',
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this property should be required?

Comment on lines +18 to +48
const allLinks = await Promise.all([
client.getItems('/en/'),
client.getItems('/en/about-us'),
client.getItems('/en/about-us/news-events'),
]);

// Flatten the array of arrays and map to FooterLink format
const footerLinks = allLinks.flat().map((ancestor: any) => ({
key: ancestor._metadata?.key,
label: ancestor._metadata?.displayName,
href: ancestor._metadata?.url?.hierarchical,
}));

// Group links by category based on URL patterns
const categorizedLinks = footerLinks.reduce<{
products: FooterLink[];
company: FooterLink[];
news: FooterLink[];
}>(
(acc, link) => {
if (link.href?.match(/\/about-us\/news-events\/.+/)) {
acc.news.push({ label: link.label, href: link.href });
} else if (link.href?.includes('/about-us')) {
acc.company.push({ label: link.label, href: link.href });
} else if (link.href) {
acc.products.push({ label: link.label, href: link.href });
}
return acc;
},
{ products: [], company: [], news: [] }
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why you need to flatten the links and re-categorize them.

Why not using the response from getItems directly?

newsLinks = await client.getItems("/en/about-us/news/events")

//etc.

# From here, all environmental variables are optional
#
# Endpoint of GraphQL. Use this variable if you use a non-production instance or a different version
# OPTIMIZELY_GRAPH_URL=https://cg.optimizely.com/content/v2
Copy link
Contributor

Choose a reason for hiding this comment

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

This is called "OPTIMIZELY_GRAPH_GATEWAY" everywhere else: https://github.com/episerver/content-js-sdk/blob/main/samples/nextjs-template/.env.in

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.

5 participants