One of the most useful customization of Sitecore is the ability to add contextual code to an item in Sitecore. For example let say we have a page in Sitecore that works well in the English language. A content author wants to create the same page in french. Unfortunately there isn't an out of the box way to copy the English page content (including all child items) into french. This is where adding contextual code will help. To do this you would have to install Sitecore powershell extensions. There are lots of documentations online about this tool. To add contextual code to an item in Sitecore, you would need to add a new module to the powershell script library located at /sitecore/system/Modules/PowerShell/Script Library/ Under this module you can add any powershell scripts you want under the context menu node. Make sure to enable the module and you should see these script under any item. You can even modify the rule section to d...
How GlassMapper works Glass Mapper is an object relational mapping (ORM) tool in Sitecore. It maps Sitecore items to strongly-typed classes. This makes it simple to access Sitecore data within C# code. Without an ORM, Sitecore developers would need to write and manage a lot of mapping code. Below are example files that you can use. You have an interface class file, a class file that implements the interface and lastly you can use this in your cshtml file. That's it. Happy Sitecoreing! IMySitecoreItemName class file namespace Your.NameSpace { [SitecoreType(TemplateId = Templates.MyTemplate.IdString, AutoMap = true)] public interface IMySitecoreItemName : IMySitecoreModel { [SitecoreField(FieldId = Templates.MySitecoreItem.Fields.MyField1)] string StringFieldName { get; set; } [SitecoreField(FieldId = Templates.MySitecoreItem.Fields.MyField2)] bool BoolFieldName { get; set; } } } Use it on your .cs file ...