/sitecore-content-sdk-nextjs-pages-router:content-sdk-pages-router-component-variantsfrom Sitecore Content SDK - Next.js Pages Router
Implements component variants with multiple renderings or data-driven presentations for the same component type in Sitecore Content SDK Pages Router. Register in .sitecore/component-map.ts; getComponentData resolves props.
Ships in Sitecore Content SDK - Next.js Pages Router. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
One component definition can have multiple presentations or data-driven variants. Component props are resolved by getComponentData(page.layout, context, components); keep registration and layout aligned.
.sitecore/component-map.ts. getComponentData resolves props; align with existing app convention.The SDK variant mechanism is identical to App Router: params.FieldNames resolves to a named export, case-sensitive; generate-map merges variant files (<Name>.<Variant>.tsx) into one map entry. The only Pages-Router difference is that props arrive via getComponentData, and registration is the single .sitecore/component-map.ts.
// src/components/Promo/Promo.Card.tsx — a variant of Promo
import { JSX } from 'react';
import type { PromoProps } from './Promo';
export const Card = ({ fields }: PromoProps): JSX.Element => (
<article className="promo-card">{/* card-specific layout, same fields */}</article>
);
export default Card;
// .sitecore/component-map.ts — generate-map merges variant exports under one componentName
import * as Promo from 'src/components/Promo/Promo'; // provides the default fallback
import * as PromoCard from 'src/components/Promo/Promo.Card'; // exports `Card`
export const componentMap = new Map<string, NextjsContentSdkComponent>([
// main module spread LAST so its `default` wins as the fallback; `Card` stays a named export
['Promo', { ...PromoCard, ...Promo }],
]);
Resolution: FieldNames: "Card" → component.Card; empty / missing / "Default" → component.default; unmatched name → <MissingComponent> + console warning. Each variant also needs a CMS Headless Variant item for the Pages dropdown. Full contract: content-sdk-variants-vs-siblings.
.sitecore/component-map.ts only. If the app uses one key per variant, register each; if one key with variant param, single registration. Follow existing app convention.npm run sitecore-tools:generate-map (it also runs on npm run dev / npm run build) rather than editing it — the generator merges every <Name>.<Variant>.tsx export into the one map entry, which is easy to get wrong by hand.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
11 skills in this plugin
/content-sdk-pages-router-component-data-strategyComponent data in a Content SDK Pages Router app: getComponentData after getPage resolves component props for the layout. Use when wiring component data or BYOC in a Pages Router app. Not App Router./content-sdk-pages-router-component-registrationRegisters components in the generated .sitecore/component-map.ts of a Content SDK Pages Router app (regenerate, never hand-edit). Use when adding a component or layout or the editor cannot find one. Not App Router./content-sdk-pages-router-component-scaffoldCreates a new Sitecore component in a Content SDK Pages Router app: file layout, props interface, src/components/ placement, generated component map. Use when adding or scaffolding a component. Not App Router./content-sdk-pages-router-dictionary-and-i18nDictionary and i18n in a Content SDK Pages Router app: next.config i18n locales, context.locale, getDictionary after getPage. Use when adding translated content or changing locale behaviour. Not App Router./content-sdk-pages-router-editing-safe-renderingMakes Content SDK Pages Router components work in SitecoreAI editing and preview: context.preview, previewData, getPreview, design library data. Use when fixing editor or preview behaviour. Not App Router./content-sdk-pages-router-graphql-data-fetchingFetches page, dictionary and component data in a Content SDK Pages Router app: getPage, getDictionary, getComponentData, getPagePaths for SSG. Use when fetching page or dictionary content. Not App Router.npx claudepluginhub chris1415/sitecore-skills-pocs --plugin sitecore-content-sdk-nextjs-pages-routerOther plugins' skills for the same job