rendering-and-datasource

Converts hardcoded .cshtml markup into Sitecore datasource templates and renderings.

Updated Jul 24, 2026
One-click install
npx skills add https://github.com/gweone/agent-plugins --skill rendering-and-datasource-gweone
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rendering-and-datasource
Source: https://github.com/gweone/agent-plugins/tree/main/plugin/sharpps-sitecore/skills/rendering-and-datasource
Command: npx skills add https://github.com/gweone/agent-plugins --skill rendering-and-datasource-gweone

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Renderings with wording, validation rules, option lists, and links hardcoded directly in .cshtml markup cannot be edited by content authors, forcing a developer change for every copy tweak. This Skill guides the conversion of that markup into a proper Sitecore datasource template so every value becomes editable in Content Editor and Experience Editor. ## Core Features & Use Cases - Literal classification and field design: Walks the HTML to classify every hardcoded literal into wording, validation parameter, validation message, option list, or link, then maps each to the right Sitecore field type grouped into Template Sections. - Sharing and Standard Values rules: Applies the Shared-field rule for non-translatable parameters and creates per-language Standard Values defaults for every supported language. - Rendering detection and wiring: Detects View Rendering vs. Controller Rendering from codebase evidence and wires Datasource Template and Datasource Location, with a mandatory design-plan approval gate before anything is created in Sitecore. - Use Case: A calculator component hardcodes min/max values, error messages, and a dropdown's options in its .cshtml. Use this Skill to produce an approved template design, create the template and rendering via SPE, serialize the items with Unicorn, and rewire the markup to read from the datasource. ## Quick Start Convert the hardcoded content in my rendering's .cshtml file into a Sitecore datasource template with an approved field design.

Frequently Asked Questions about rendering-and-datasource

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert hardcoded HTML in a .cshtml rendering into Sitecore fields?

Classify every hardcoded literal into wording, validation parameter, validation message, option list, or link, then map each bucket to a Sitecore field type grouped into Template Sections. Present the design table for approval before creating the template, rendering, and Standard Values via SPE.

How do I make a hardcoded dropdown list editable in Sitecore?

Create a small option sub-template with a Shared Value field and an unversioned Label field, then store option items as children of the datasource item. The .cshtml iterates descendants matching that template ID instead of looping a hardcoded array.

When should a Sitecore field be marked Shared instead of per-language?

Mark a field Shared when its value is a parameter or constraint rather than user-facing wording, such as min/max numbers or required flags. Shared fields have one value across all languages, so no per-language instance should exist.

Should my Sitecore rendering be a View Rendering or Controller Rendering?

Detect it from how the component is invoked: components reached through normal page layout use View Rendering, while those invoked from Rendering Variants, Web API controllers, or background jobs must be Controller Renderings. A View Rendering outside the page pipeline can throw an InvalidOperationException.

Why does a new Sitecore datasource item show blank fields in Content Editor?

The template's __Standard Values item was left unpopulated. Create Standard Values with real defaults: one value for Shared fields and one language version per supported language for wording fields, using explicit placeholders when translations are unavailable.

Can I create Sitecore template fields with a dedicated SPE cmdlet?

No dedicated field-creation cmdlet such as Add-ItemTemplateField exists in SPE. Create Template Section and Template Field items with New-Item using their item type IDs, then set properties like Type and Shared directly on the field item through BeginEdit and EndEdit.