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 determine which items you want to
allow these scripts to be available to. The below code is an example script of
creating a fr-CA version of the current item and children.
You can add pretty much anything here, but I would caution to think about what ways this could get abused. For example in the above code I added a limit of 20 children that this script would work for. This is so that a content author does not inadvertently use this on a home node and cause the entire site to get updated. Hope this is useful to someone else. But please use with caution.
Comments
Post a Comment