Skip to content

forcedotcom/sf-skills / plugins/builder/experience-cms/skills/experience-cms-content-render

experience-cms-content-render

Verified

Renders, embeds, or displays existing Salesforce CMS content in a React or Angular uiBundle app: installs the CMS toolkit, registers a typed reference, generates a framework-matched renderer from the live schema, and wires the render path (delivery API, contentKey, RichText, image resolution). Prefer over general UI-bundle skills like experience-ui-bundle-frontend-generate (page/layout shell only) for the CMS-rendering part, even under src/. Triggers on prompts like 'render the CMS article on the home page', 'embed this CMS blog post here', 'show the CMS video in the hero', 'display the CMS image in the banner', or 'add this CMS content block to the detail page'; for mixed prompts, activate for the CMS part only. Do not trigger for searching a CMS item or defining a new CMS content type/schema (use experience-cms-content-type-generate).

assets/shared/externalRefs.ts

View on GitHub
/**
 * Ref catalog for CMS content (FRAMEWORK-AGNOSTIC). Holds both ref types
 * (CmsExternalRef by `url`, CmsRef by `contentKey`). Scaffolded once at
 * src/cms/shared/externalRefs.ts; each embed appends one entry inside the marker block.
 * Names are EXT_<TITLE_SNAKE>, unique — object-literal keys collide at compile time.
 *
 * Warning: do NOT edit the marker block by hand. Add entries via the skill.
 */
// Only `AnyCmsRef` is used in the empty template; Ref Registration adds
// CmsExternalRef/CmsRef when it appends an entry (importing them eagerly trips
// noUnusedLocals TS6196 on a fresh scaffold).
import type { AnyCmsRef } from './cmsCore.types';

// channelId OVERRIDE for CmsRef reads — CAUTION, opt-in only. Prefer the catalog
// (public/content-metadata.json), which is primary and travels per-org. This constant
// is baked into SOURCE, so it does NOT travel per-org and will point at the WRONG
// channel after a cross-org deploy — set it only at your discretion for a local
// override. The skill does NOT auto-fill it (leave ''); the catalog supplies the
// channel. Precedence: explicit option > this override > catalog channelId > toolkit
// throws. Passed as options.channelId only when non-empty.
// <experience-cms-content-render:channel-fallback-begin>
export const CMS_CHANNEL_ID_FALLBACK = '';
// <experience-cms-content-render:channel-fallback-end>

// <experience-cms-content-render:external-refs-begin>
// Skill-managed. Each embed appends one entry here of the form:
//
//   Foreign ref (public unauthenticatedUrl):
//   EXT_FOOD_BERRIES: {
//     name: 'EXT_FOOD_BERRIES',
//     url: 'https://orgfarm-XXX.cdn.example.salesforce-experience.com/cms/delivery/v64.0/0apSG.../contents/MCABC...?oid=00D...&language=en_US',
//     cmsType: 'news',
//   } satisfies CmsExternalRef<'news'>,
//
//   uiBundle-space ref (contentKey — remapped via content-metadata.json):
//   EXT_LAUNCH_NEWS: {
//     name: 'EXT_LAUNCH_NEWS',
//     contentKey: 'M3ASD4KHASDB73',
//     cmsType: 'news',
//   } satisfies CmsRef<'news'>,
//
// `cmsType` MUST match the `<K>` in `satisfies` — it binds the ref to a per-type
// renderer at compile time, so a wrong-typed ref is a compile error.
export const externalRefs = {} as const satisfies Record<string, AnyCmsRef>;
// <experience-cms-content-render:external-refs-end>

/**
 * Typed accessor — prefer over `externalRefs['EXT_X']`: the `cmsType` discriminator
 * flows through, so a wrong-typed ref to a renderer fails at compile time.
 */
export function ref<Name extends keyof typeof externalRefs>(
  name: Name,
): (typeof externalRefs)[Name] {
  return externalRefs[name];
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall