RAZL (Retrieval Augmented Zero-shot Learning prompts in the Sitecore AI stack) only works when your component templates, datasource patterns, and rendering paths are boringly consistent. Authors should not guess which fields exist on a Hero versus an FAQ accordion. Prompt libraries must mirror template sections, enforce max lengths, and return JSON shapes your import scripts or Sidekick field maps can consume without manual cleanup.
Component and datasource template patterns
Every rendering in /sitecore/layout/Renderings/ should have exactly one primary datasource template (or a small allowed set documented in rendering parameters). Split “page” data from “component” data: page items carry route metadata; datasource items carry author-facing copy.
Pattern: single datasource per rendering
Rendering: /sitecore/layout/Renderings/Project/Corp/Hero Datasource template: /sitecore/templates/Project/Corp/Hero Datasource location: /sitecore/content/Corp/Data/Heroes Parameters template: /sitecore/templates/Project/Corp/Hero Parameters
Pattern: shared base template
Define /sitecore/templates/Project/Corp/_BaseComponent with:
ComponentTitle(internal tracking, not rendered)Theme(Droplist from taxonomy)CacheClearingBehavior(for ops, not AI-filled)
Hero, FAQ, and Promo templates inherit base fields so prompt libraries share a common header block in JSON output.
Pattern: folder conventions
Store datasources under typed folders (.../Data/Heroes, .../Data/FAQs) so RAZL retrieval scopes to the correct subtree. Random datasource locations break retrieval and inflate token usage.
Field max lengths and validation
Define max lengths in template field Source or validation rules, not only in prompts. Prompts drift; validation rules block publish.
| Component | Field API | Max length | Type |
|---|---|---|---|
| Hero | Title | 80 | Single-Line Text |
| Hero | Subtitle | 120 | Single-Line Text |
| FAQ | Question | 150 | Single-Line Text |
| FAQ | Answer | 800 | Rich Text |
| SEO | MetaTitle | 60 | Single-Line Text |
| SEO | MetaDescription | 160 | Single-Line Text |
| Promo | Headline | 70 | Single-Line Text |
| Promo | Body | 400 | Rich Text |
SEO fields use character limits aligned with SERP display, not storage limits. Enforce in prompt and in custom validator.
JSON output shapes
RAZL prompts should request strict JSON so downstream mapping does not parse prose. Standard envelope:
{ "componentType": "Hero", "templateId": "{GUID}", "fields": { "Title": "string", "Subtitle": "string", "Body": "string", "CTALabel": "string", "CTALink": { "href": "string", "text": "string", "target": "_self|_blank" } }, "metadata": { "promptVersion": "1.2.0", "confidence": 0.0 }
}
FAQ components return an array:
{ "componentType": "FAQ", "items": [ { "Question": "string", "Answer": "string" } ], "metadata": { "promptVersion": "1.0.0" }
}
Reject responses that include markdown fences or commentary outside JSON. Your import script should fail closed.
Legal banned terms
Maintain a centralized banned term list injected into every prompt:
BANNED_TERMS = [ "guarantee", "guaranteed", "best in class", "leading provider", "risk-free", "#1", "always", "never fails", "competitor names..."
]
Post-validate JSON string values with case-insensitive match. Log violations with component ID and author ID. Legal should review the list weekly during pilot.
Hero prompt library (full example)
SYSTEM: You are a Sitecore component author assistant. Output JSON only.
Template: Hero (/sitecore/templates/Project/Corp/Hero)
Max lengths: Title 80, Subtitle 120, Body 2000, CTALabel 40.
Do not use these terms: {{BANNED_TERMS}}.
Voice: direct, active sentences. No exclamation marks in Title. USER: Page context:
- Page name: {{page.displayName}}
- Audience: {{audience}}
- Primary keyword: {{keyword}}
- Brand: {{brandName}} Generate Hero fields for a B2B software landing page section.
Return JSON matching the Hero schema. CTA link href must be relative (/path) unless given absolute URL. ASSISTANT: (JSON only)
FAQ prompt library (full example)
SYSTEM: Output JSON only. Component type FAQ.
Each Answer max 800 characters plain text (no HTML).
Questions max 150 characters. Provide exactly {{count}} FAQ items.
Banned terms: {{BANNED_TERMS}}. USER: Product: {{productName}}
Support themes: {{themes}}
Existing questions to avoid duplicating: {{existingQuestions}} Generate FAQ items addressing pricing, implementation time, and support SLA.
Use schema:
{"componentType":"FAQ","items":[{"Question":"","Answer":""}],"metadata":{"promptVersion":"1.0.0"}} ASSISTANT:
SEO metadata prompt library (full example)
SYSTEM: SEO metadata only. JSON output.
MetaTitle max 60 characters including spaces.
MetaDescription max 160 characters.
Include primary keyword in MetaTitle near the front.
No banned terms: {{BANNED_TERMS}}. USER: Page title: {{pageTitle}}
Primary keyword: {{keyword}}
Secondary keywords: {{secondaryKeywords}}
Page summary: {{summaryBullets}} Return:
{"componentType":"SEO","fields":{"MetaTitle":"","MetaDescription":"","OgTitle":"","OgDescription":""},"metadata":{"promptVersion":"1.1.0"}} ASSISTANT:
Promo band prompt library (full example)
SYSTEM: Promo band component. JSON only.
Headline max 70 chars. Body max 400 chars. Rich text allowed in Body (p, strong, a only).
CTA required. USER: Campaign: {{campaignName}}
Offer details: {{offerDetails}}
Expiry: {{expiryDate}}
Compliance note: no superlatives, no competitor references. Return Promo schema with fields Headline, Body, CTALabel, CTALink.
ASSISTANT:
Rendering paths and placeholder discipline
Register renderings under a stable path mirror of your component library:
/sitecore/layout/Renderings/Project/Corp/ Hero FAQ Accordion SEO Metadata Promo Band Content Block
Rendering parameters should not duplicate datasource fields. If Title lives on datasource, do not add TitleOverride on parameters without documenting precedence (parameters win vs datasource wins). RAZL prompts need that precedence in the user block or authors get conflicting fills.
Example rendering configuration snippet:
<rendering id="{HERO-GUID}" name="Hero" template="/sitecore/templates/Project/Corp/Hero" datasourceLocation="/sitecore/content/Corp/Data/Heroes" placeholder="corp-main" />
Measuring time-to-draft
Time-to-draft starts when an author opens a new datasource item (or clicks “Generate with AI”) and ends when all required fields pass validation and the item is saved in Draft workflow state.
Instrument three timestamps:
t0: panel openedt1: JSON accepted into fieldst2: save successful, validation passed
Metrics:
- Generation latency: t1 minus t0 (model + retrieval time)
- Author edit time: t2 minus t1 (human cleanup)
- Total time-to-draft: t2 minus t0
Compare against manual baseline from pre-pilot timing study (same component types). Target: 40% reduction in total time-to-draft with edit distance under 0.25 on Body fields. If generation latency exceeds 8 seconds P95, check retrieval scope size and reduce folder breadth.
Sample logging hook (CM pipeline or custom endpoint):
public void LogDraftMetrics(string itemId, DateTime t0, DateTime t1, DateTime t2) { var metrics = new { itemId, generationMs = (t1 - t0).TotalMilliseconds, editMs = (t2 - t1).TotalMilliseconds, totalMs = (t2 - t0).TotalMilliseconds, template = GetTemplateName(itemId) }; _logger.Info("razl_draft_metrics", metrics);
}
Prompt versioning and rollback
Store prompt templates in source control with semantic version in metadata.promptVersion. When edit distance spikes after a prompt change, roll back one version and compare field-level diffs on a fixed test set of ten datasource items.
Test set criteria:
- Two Hero items (short and long page context)
- FAQ with 5 and 10 items
- SEO for product and legal pages
- Promo with expiry date near term
Author training snippets
Authors need three rules, not a model lecture:
- Always read JSON-populated fields before save; do not trust CTA links without clicking.
- If a field violates max length, fix manually and file a prompt ticket; do not truncate blindly.
- Reuse existing datasource items when copy is similar; RAZL retrieval works better with more examples in folder.
Datasource naming conventions for retrieval
RAZL retrieval quality depends on folder density and naming patterns. Enforce:
Hero - {PageName} - {Variant}for datasource display names- No duplicate display names in the same folder (breaks author search and confuses embedding indexes)
- Archive rejected drafts to
.../Data/_Archiveoutside retrieval scope
Configure retrieval root in prompt config per component type, not global site root. Global roots pull navigation labels, footer legal text, and old campaign copy into Hero prompts.
Rendering parameters vs datasource: precedence rules
Document precedence in prompt system blocks when both exist:
PRECEDENCE:
1. If rendering parameter TitleOverride is non-empty, do not fill datasource Title.
2. SEO MetaTitle always lives on page item, never datasource.
3. FAQ items array always datasource; never parameters.
Authors get wrong output when Sidekick fills a field that rendering code ignores. Audit renderings for Model.Title ?? Parameters["TitleOverride"] patterns before writing prompts.
Content Block and modular slice prompts
Long-form Content Block templates need section-aware prompts:
SYSTEM: Content Block with sections Intro, Bullets, Closing.
JSON schema: { "Intro": "string max 400", "Bullets": ["string max 120"], "Closing": "string max 300" }
Bullets: 3 to 5 items, parallel grammar, no nested lists. USER: Topic: {{topic}}
Reading level: grade 10
Compliance: no medical claims
Return JSON only.
Validate bullet count in import script; models drift toward 7 bullets when unchecked.
Import script: fail closed on schema violations
function Import-RazlJson($item, $json, $schema) { $obj = $json | ConvertFrom-Json if ($obj.componentType -ne $schema.Type) { throw "Type mismatch" } foreach ($field in $schema.Fields) { $val = $obj.fields.($field.Name) if ($null -eq $val -and $field.Required) { throw "Missing $($field.Name)" } if ($val.Length -gt $field.MaxLength) { throw "Overlength $($field.Name)" } foreach ($term in $schema.BannedTerms) { if ($val -match $term) { throw "Banned term in $($field.Name)" } } $item[$field.ApiName] = $val }
}
Run import in transaction; on failure, item stays unchanged. Authors prefer explicit error to partial fill.
Retrieval chunk sizing for FAQ and long pages
FAQ prompts with retrieval from similar products need chunk limits. Cap retrieved examples at three items or 1500 tokens. More context increases duplicate question risk. Store retrieval debug output in dev-only logs: which item IDs were injected into the prompt.
Multilist and taxonomy-driven components
Promo components that reference taxonomy tags need prompts that output tag keys, not display names:
"TaxonomyTags": ["Topic/Leadership", "BusinessLine/Healthcare"]
Import script resolves keys to Sitecore tag items under /sitecore/content/Corp/Settings/Taxonomy/. Missing keys fail import with readable message for authors.
A/B prompt variants for tuning
Run variant A and B on test set only, not production authors, until winner clears edit distance threshold. Label variant in metadata.promptVersion as 1.3.0-a vs 1.3.0-b. Never run unlabeled A/B in production without governance sign-off.
Integration with Sidekick field maps
RAZL JSON output should use the same API names as Sidekick field maps on the same templates. Maintain one YAML or JSON registry in git:
templates: - id: "{HERO-GUID}" name: Hero fields: - api: Title max: 80 razl: true sidekick: true
Splitting registries between RAZL scripts and Sidekick UI guarantees drift within one sprint.
Accessibility fields in component prompts
Hero Image alt text and FAQ aria labels belong in prompts for regulated sites:
"ImageAlt": "string max 125, describe image content not marketing copy"
Legal often requires alt text not duplicate Title. State that explicitly in system block.
Performance: batch generation limits
Authors click “generate all fields” and timeout CM when prompts retrieve half the site. Rate limit per user: max 10 RAZL calls per minute in pilot. Queue batch field generation server-side with progress UI instead of parallel HTTP storms.
Regression pack for component prompts
Store ten golden JSON outputs in git per component type. When prompt version bumps, diff new output against golden files in CI. Allow intentional diff only when PR updates golden files with reviewer sign-off. Catches silent regressions when model backend updates outside your control.
Golden file example path: tests/razl/golden/hero-product-launch.json. Pipeline runs RAZL against fixed context fixtures, normalizes whitespace, compares keys and string values.
Promo and legal disclaimer components
Promo bands often sit above footers with strict legal disclaimers nearby. Prompt must instruct model to avoid financial promises in Promo Headline while leaving disclaimer text untouched on sibling component. Scope RAZL to selected datasource item only; never pass entire page tree as context for Promo prompts or disclaimers get rewritten.
FAQ schema and structured data fields
When FAQ components feed JSON-LD, add optional prompt output for SchemaQuestion trimmed to Google FAQ limits. Import script validates FAQ count between 2 and 10 for valid schema. Authors otherwise publish rich results errors that search console flags weeks later.
Keep FAQ answer plain text in JSON even when Body field allows Rich Text elsewhere. Mixing HTML into FAQ schema output breaks import validators and rich result parsers. Strip tags in import if authors paste HTML manually after generation.
Actionable checklist
- One primary datasource template per rendering under
/sitecore/layout/Renderings/Project/. - Publish field max length table and enforce in template validation rules.
- Deploy Hero, FAQ, SEO, and Promo prompts with strict JSON schemas and banned term injection.
- Centralize datasource folders by component type for retrieval scope control.
- Instrument t0/t1/t2 timestamps and log generation vs edit time separately.
- Baseline manual time-to-draft before comparing RAZL-assisted flows.
- Version prompts in git; maintain ten-item regression set for prompt changes.
- Fail closed when JSON parsing fails or banned terms appear in output.
- Document rendering parameter vs datasource precedence for every conflicting field.
- Review median edit distance weekly; rollback prompt version if threshold exceeded.