Best Practices – Solution Code

Sitecore recommended practices for solution code:

  • Sitecore highly recommends using C#. All of the Sitecore programming examples are in C# and C# is the language spoken by Sitecore Support.
  • Use GUIDs where possible instead of path / name. This will improve performance, as well as prevent any breakage if you move content to a new location in the content tree.
  • Use the Sitecore Search API instead of query or fast query. This allows querying based on indexes, rather than the content structure.
  • Follow best practices for Web, Windows, IIS, ASP.NET, XML, XSL, SQL, .NET, CSS, JavaScript, and other technologies. For example, comment your code to describe the intent, not the implementation.
  • Avoid //, descendant and descendant-or-self axis in XSL renderings.
  • Use App_Config/Include files instead of directly modifying the web.config file.
  • Don’t hardcode information in the code, use <settings> in a *.config file.
  • Use parameters and properties when creating pipelines/events.
  • Don’t hardcode labels and other static text information, consider modeling it with items, or create a dictionary in Sitecore.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Website Powered by

Up ↑

%d bloggers like this: