There are several useful articles and blogs about #Sitecore best practices, but I am trying to put together my learning on this area. Sitecore has different components shipped within it i.e “analytics“, “workflows“,”personalization” and others.
Before starting or working on any application, our main focus should be to understand application as a whole and not just part of it, believe me this is a key for overall success of your implementation, try to get involved and get more and more information about the solution as a whole.Once you have a big picture in mind, it’s easy to work on small features and then for integrations.
There are several categories we can have, when we talk about Sitecore best practices:
- Content structure.
Templates: Templates are the base for any Sitecore implementation, templates are grouping of certain fields that make one entity/table in Sitecore, which can have one or more then one field(s). There are few things which we should consider while designing a template.
- Think about the entity first and all related fields which can be grouped.
- List down all the fields which needs to be added to a particular entity.
- Now identity if there are any set of fields which are common to other entities as well, at least to few, if not all, like “Headline”,”Teaser”, “Main Content” or “Image” fields.
- If you get a list of common fields, then create a new “Base Template” and add all those fields in that template, this is also to make sure we are reusing the template and fields as much as possible.
- You can use the “Display Name” property to provide a user-friendly name for any item.
- Always try to group fields in section, this is logic separation of fields, still all the fields comes under same template only.
- Try to give user friendly name for all sections,fields and templates so that business users/content authors can identify and understand them easily.
- Always set default values in standard values of template, so that we can prepopulate some of the field values.
- If there is predefined structure we have to follow, we should always consider branching template, this really helps content authors and they will love you for this.
- Try to have unique icon added to you template, so that it is easy to recognize.
- Presentation should be configured in standard values, so that it can be applied to all instances of that template.
- Creation of “Base Templates” should always be in your radar, so that you can make use of Sitecore inheritance where required.
Content structure: This is the second step where we create items based on the template created, content structure helps content authors to look for the information or details they are interested, here are some of the things that we should consider while creating/designing content structure.
- As a standard, try not to have more than 100 items under particular node, can be folder or page item, this can impact Sitecore performance.
- If expecting more than 100, then consider using buckets or if not buckets create folders in a way that it doesn’t exceed more then 100 child per folder/item.
- Try to have only page items created under home page, this can change, you can read my blog on different options for configuring content tree https://ankitjoshi2409.wordpress.com/2017/02/07/structuring-and-organizing-sitecore-content-in-content-tree/
- Plan content structure based on site map, place all the items which are accessed using URL as descendants of the website, we should mimic sitemap structure in sitemap as well.
- Make sure we have security added for items which which should not be accessed by specific user role(s).
- Indexes should be configured for automatic updates,for better and faster content editor experience.
- Make sure to consider multi-site environment as well, and create folder accordingly, this also helps in content sharing from one site to another.
- Try to create folder template for structuring page items, should try for it as much as possible so that we have more control on the tree.
- Maintain only a few versions of each item in the implementation- this is to improve the performance.
Presentation : Some of the things to consider while setting up the presentation:
- Page should be Experience editor friendly.
- Make sure to use Experience editor friendly tags like
- Sublayout(s) and Rendering(s) should be configured to be cachable for better browsing experience.
- Rendering should be added to page template standard values,when applied at an item level, any changes to the layouts require a lot of effort to make changes to all items. When applied at standard values, such modifications become easier.
- Any updates to the specific should be done directly on final layouts, please read my blog for more details- https://ankitjoshi2409.wordpress.com/2017/02/06/sitecore-shared-vs-final-layouts/
- Rendering should have data source template and data source location defined, this helps personalizing the site and making sure the application is experience editor friendly, this is important configuration for Experience editor.
- All the components/rendering(s) should have thumbnail image added to it, this helps CAs configuring dealing experience editor nicely.
- Use placeholders settings and allowed control setting, so that CAs can add/create only those modules which are required for that page design to work.
- Don’t allow a single template to contain two fields with the same name.
- Avoid hard-coding as much as possible so that we don’t have to update the code, if any change required.
- Use IDs instead of paths/name whenever possible.
- Avoid using any form of the descendant axix, like GetDescendents
- Try not to modify Sitecore base files and use Sitecore patching for any updates to config files, this helps in upgrade process if required.
- Content Editing should be done on the master database, and then pushed to web database.
- Restrict access to content delivery servers.
- Use the general best practices of developments applicable to C# with tools like Re-sharper.
- Set up continuous integration.
As I mentioned before there are lot of articles that has more details on best practices and guidelines, please make sure to read those as well.
I hope this will give you some degree of information, which can be applied while designing any structuring your Sitecore site.
Please feel free to add feedback and comments, happy to discuss more.
Happy learning 🙂