Unpublishing child items in Sitecore

There are scenarios where we want to unpublish all the child items in Sitecore, and need to publish only few from specific folder/item, this is also required because as a content author we don’t want to delete the items from content tree permanently, but just want to remove it’s reference from web DB, such that when required item can be made available for publishing.

Some examples includes:

  1. Video Repository like Brightcove
  2. Product Repository in Sitecore, whose source is some third party CRM systems.
  3. Employee Repository

Client is not 100% done with all the content authoring, and haven’t reviewed all the content as well, in this case it makes most sense to unpublish all the items, and publish only which is verified by the business and content team, so that only tested content and pages can be made public.

Instead of going to each content item and unpublish one by one, there is an easy to unpublish all the child items at once.
Please follow the below steps to unpublish all child items:

  1. Go to the item in Sitecore for which all child items need to be unpublished.unpublishparentitem
  2. Before we make any updates, please try to browse any child item and make sure that you can browse the page, once this is tested we can move to next step.
  3. Now, go to “Publish”->”Change” option.
  4. From there select “ITEM” tab and uncheck “Publishable” checkbox.
  5. This makes all the child items unpublished.unpublishable
  6. Now publish your parent item,and all child items under it.
  7. Try to load the same child page, and your page status should be 404 now.
  8. Next, go to the parent folder/item again and publish only that item.
  9. Now, go to individual child item(s) and publish only those which are required.
  10. Try to load the page, and this time it should load it as expected.

This way we can keep all content items in Sitecore tree, but doesn’t promote it to web database.

As child items inherit the publish status of the parent item, setting the “Publishable” checkbox to false make sure that items are removed from web.

I hope this will help someone, who is trying to remove all the child item(s), but at the same time, also don’t want to delete items permanently.

Happy learning ūüôā

Resolving issue with page preview in Sitecore multisite configuration

With Sitecore multisite solution and architecture, we see site resolving logic might seem to work in unexpected ways sometime,and i encountered this issue couple of weeks back, here are few things to consider with Sitecore multisite configuration.

Let’s assume we have two sites in the same Sitecore instance, this is how the typical structure looks like:


In order to have two sites in the same Sitecore instance, we also need to add site node settings which is present as part of Sitecore.config now,this is how it looks:

<site name=”website” enableTracking=”true” virtualFolder=”/” physicalFolder=”/” rootPath=”/sitecore/content” startItem=”/home” database=”web” domain=”extranet” allowDebug=”true” cacheHtml=”true” htmlCacheSize=”50MB” registryCacheSize=”0″ viewStateCacheSize=”0″ xslCacheSize=”25MB” filteredItemsCacheSize=”10MB” enablePreview=”true” enableWebEdit=”true” enableDebugger=”true” disableClientData=”false” cacheRenderingParameters=”true” renderingParametersCacheSize=”10MB” />

<site name=”my-new-site”…../>

<site name=”website”….> is the default setting that comes with Sitecore, we need to add any new site added to system here, so that site can be resolved, in this example we added “my-new-site” to the list.

It is recommended to keep the Rendering.SiteResolving setting value at “true” for any multisite solution in order to ensure that cross-site links are built with the correct parameters.
Here, the Experience Editor and Preview mode are opened in the context of the site defined in the Preview.DefaultSite setting.

In my case, I observed the page preview mode was throwing error, and when i looked into the “Preview.Default” setting in Sitecore.config file, it was pointing to “website
We had “website” site node , but the location was no longer exists- it was pointing to /sitecore/content/home and we didn’t had any item in this location.

So, there are two options here to resolve this issue:

  1. Update the “website” site node start item in Sitecore.config to point to active site/ location or
  2. Update “Preview.DefaultSite” mode settings with an active site.

Note: Please make any updates to Sitecore.config using Sitecore patch file, so that we don’t mess up anything with the default configurations, and down the line didn’t face any issue with Sitecore upgrade as well.

Also, to make sure that items are opened in context of correct site, we must set the Rendering.SiteResolvingMatchCurrentSite setting to “true”

All configs related to site resolving can be found (“/App_Config/Sitecore.config” in Sitecore 8.x and web.config in 7.x)

Please read more about the site resolving here- https://kb.sitecore.net/articles/986056

Happy learning ūüôā

Sitecore best practice and guidelines

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:

  1. Template.
  2. Content structure.
  3. Presentation.

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.

General Practice:

  • Don’t allow a single template to contain two fields with the same name.
  • Use a source code management system to manage all code,this includes JavaScript and CSS as well.
  • 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 ūüôā

Troubleshooting Sitecore performance and optimization

Most of us might have faced issues with performance and slow Sitecore instance,I would like to share my experience with Sitecore troubleshooting which I have learned over the period of time, these are some of the things which I feel should be checked whenever we see the application has really some performance issues.

Trust Building:
This is one of the key factor of healthy business relation, we should make sure that application/business always meets users expectation, a non performing(from performance standpoint) site can’t guarantee a high ROI.

Here are few things i would like to mention to check the slow performing Sitecore site, and what can be done to fix it.

  1. Logs Reviews: 
    1. This is one of the wonderful feature which is shipped with Sitecore, and we should make use of it to check the performance of the application, regularly checking the logs can help us in fixing the issue well before in time before it becomes critical.
    2. Logs can give us most of the details which includes:
      1. Publishing details.
      2. Schedule task running.
      3. Any code error issue.
      4. Indexing or query issue.
      5. Issue with  MongoDB connectivity.
      6. Issue with SOLR server connectivity.
      7. Issue with SQL server connectivity
    3. Above are some of the details which we can review and proceed our investigation, it’s always better to have something in hand to troubleshoot, instead of randomly looking for something.
  2. Enable JS,CSS Compression:
    1. This helps in boosting the performance of application, by reducing page request to server or browsing the pages.
    2. We can make use of static and dynamic content compression in IIS.compression
  3. Sitecore Debugging:
    1. We should make use of Sitecore debugger tool which can be found in Page editor, this gives a very good understanding and statistics around different components being used in the page.
    2. Helps in understanding which specific component(sublayout/rendering) takes how much time to render on the page.
    3. One of the early troubleshooting which every developer should start doing right from the time we start experiencing performance issue in local development environment.
    4. This tools helps in narrowing down the problem with code,and thus helps in putting all our energy and time in right spot.sitecoredebugsitecoredebugprofile
  4. Sitecore Schedule tasks:
    1. Always try to review the Sitecore schedule tasks, and see if there is any task which is running and which is not expected?
    2. Make sure to review all the agents which is present under <agents> section, in web.config or using custom patch(if used).
    3. Another thing to note, we should also consider updating the frequency of that task execution by updating the time,if schedule task is not required we should disable it.
    4. See if the schedule task is triggering site full publish, this can be a serious issue in production environment,as this can clear all cache which can slow down the site.
    5. Keep close watch on the logs for anything related to schedules tasks.
  5. Indexing Strategy:
    1. Revisit the indexing strategy which is being used in the application, see if the full index rebuild is in place for any item publish event.
    2. Try to update the strategy if it’s not as per the requirement, or if it’s over killing.
    3. Please review this document for anything related to available indexing strategy-  https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/indexing/index_update_strategies
  6. Image optimization:
    1. I have seen this issue with several applications, just because the images are not properly optimized, they end up taking more resource bandwidth and resulting poor user experience.
    2. Remember, this is the time of mobile, and any poor performing mobile site can be a serious issue to client.
    3. We should always train and educate our client and content authors to make use of optimized images, and trust me they will listen to you.
  7. Indexes:
    1. This is one of the critical and important part of any Sitecore application, try to use indexes as much as possible when it comes to fetching details from the repository or searching of the items based on specific condition and filters.
    2. Try to perform all the operation directly in the query like:
      1. Pagination.
      2. Sorting
      3. Filters
    3. Avoid fetching all the results and then applying business rules to filter it based on specific condition, as I mentioned try to do most of the processing directly in query level.
    4. I had seen issues in application which was not performing well, just because of not making true use of indexes,review you index definition and configuration,and see if it has everything which is expected for it.
    5. Try to use create and use custom indexes for any custom feature, it’s always better to have one.
    6. Use of computed fields can be considered, this helps in executing any complex business logic while querying the results.
  8. Site publish:
    1. We should not trigger complete site publish in production environment,unless and until it’s very much required, this can be a costly operation, as this clears all the cache.
    2. Try to publish only areas which are required, we can trigger full site publish in development environment, but should be done carefully in production.
    3. Use Smart or Incremental Publish.
  9. Caching:
    1. Configure sublayout(s) and rendering(s) to use caching, this can give a real good browsing experience to site users.
    2. Clearing cache is something which should be considered in production environment, when trying to publish items this will clear the cache and can slow down the application performance.
  10. GetDescendants:
    1. Use of GetDescendants is one of the costliest operation we can think off, we should always try using indexes or fast queries if possible and required.
    2. Revisit your code and search if there is any reference to GetDescendants, and update it if required.
  11. No of Items under one node:
    1. Try not to have more items under single node/item, and break it down using several sub folders or items.
    2. This helps in giving good content editor experience.
    3. make use of item buckets wherever applicable.

Few important things to follow:

  1. Write good code.
  2. Proper unit testing.
  3. Get your code reviewed.
  4. Follow best practices.

This helps in fixing some of the issues before it goes to QA.

Please also refer Sitecore recommendation for performance optimization : https://sdn.sitecore.net/Articles/Administration/Sitecore%20Performance/Optimizing%20Sitecore%206%20and%20later/Optimizing%20Performance%20in%20Sitecore.aspx

I hope this helps someone in troubleshooting Sitecore performance issues, please let me know if you have any questions or comments, happy to discuss.

Happy learning ūüôā

Creating multiple crawlers for custom Index in sitecore

When we discuss/talk about indexes to be used in sitecore solution, various indexing strategies, no# of indexes, application performance  and etc, following are few things which we should review and discuss first:

  1. What is the search requirements, which depends more on business requirements.
  2. Do we really need indexes?
  3. Can we make use out of the box sitecore APIs to get the data from sitecore?, or extra index set up required.
  4. If index required, can we make use of out of the box sitecore indexes(lucene/SOLR or Coveo)?
  5. Do we need to set up custom indexes?
  6. If custom index(s) needed, what are the different content you want to add to your index?

These are some of the questions which we should think, before¬†discussing anything more or making any call for indexes and it’s setup.

But, i would like to focus on the area where the business justifies the need of indexes and custom indexes to be more specific, and which is mainly this blog is focused on.

Question: Can we make use of sitecore out of the box indexes for any custom implementation?

I would say No to this, as we should always try to architect the solution as loosely coupled as possible, but again it also depends on the requirement sometime, we shouldn’t be thinking about making a new custom index when the custom need is not that complex, and didn’t affect the performance of the application as a whole.

Following are couple of things to consider:

  1. How update index strategy will work based on specific conditions and scenarios.
  2. Any configuration update to the index, which is needed for the custom implementation.

In certain¬†scenarios where we want to make the implementation as clean as possible and want to make sure it didn’t affect¬†the maintenance and updates, I think we can definitely go with custom indexes, and make changes to the settings based on the requirement.

Let’s looks the configuration of default SOLR index:


If you see the locations tag, there exists a crawler which will make sure to index the contents of the applications from specific database and specific location within sitecore,¬†In this specific case it will index everything under sitecore, because that’s what the value we have under Root node.

Now, let’s think about a scenario where we want to index only two locations:

  1. All page items(which has presentation added to it) and
  2. All media items or any page item(s) which are structured outside of home node.
  3. To be more generic, we are trying to add two different locations in index, it can exists within home or outside home.

In order to support this scenario, we can add multiple crawlers for the same index, please see the below config for sample:


From the above screen shot you can see we have the same index, but with two crawlers which points to two different locations in sitecore.

Also,we ¬†have to make sure that ¬†both the crawlers in this case use the different name, which is more meaningful to the content type which¬†will be indexed, we have used “PageCrawler“- which index all page items under home node and “MediaCrawler“- which index all media items under media library folder.

Following are the advantages of having multiple crawlers in the same index:

  1. Helps in boosting sitecore/application performance.
  2. Helps in applying business rules directly in the query, like pagination,sorting of pages,as now we get the different types of items from the same index.
  3. Easy maintainance.

Setting up only one crawler, or going with multiple crawlers is something point of discussion and  it mainly depends on the requirements of the application, as in general we should always keep in mind the application performance and maintenance in mind before wiring up any solution to the system.


  1. https://community.sitecore.net/developers/f/5/t/2112


I hope this post can help someone who has some questions on where and how to implement multiple crawlers in sitecore, and indexing question(s) in general.

Happy learning ūüôā

Structuring and organizing sitecore content in content tree

I was discussing with my colleagues few days back on how best we can structure sitecore items in content tree, so that it adds more value for content authors, whoever is working on the implementation should not get confused with it, and in fact the organization of content tree should help the content authors in understanding the functionality and flow of application.

A well organized sitecore content tree speaks a lot.

I feel we can’t go with a generic approach and follow the same always across all the implementation, and for different clients as well,sometimes the decision is based on techinical feasibility and sometimes it’s more client centric.

Thought of sharing the details here, so that we get more room for discussion and if anyone follows a better way, we will learn something new.

There are two type of content we can think of:

  1. Page content (actual pages)
  2. Page related content (any piece of information, which can be shared across different page items, or can be page specific)

Page Content: Page Content in this context are actual pages which are created under home node, following are the examples of page contents:

  • About us page
  • Contact us
  • FAQ page
  • Terms and conditions and etc

Page contents are generally stored under home node, and closely matches the structure of the site.

Page related content:¬†when we talk about page related contents, it’s mostly about the information which we display as part of complete page, following are the examples of related content(s):

  • Image component (which has only image)
  • Generic component (which has couple of fields to enter title and description and another field to add Image)
  • Collection of links and etc

Configuring Page related content(s):

This was always a question how best we can structure related contents for a particular page, in order to answer this, there are few things which we need to understand:

  1. If related content is specific to that page, or it can shared with other pages as well?
  2. If related content can be shared with other sites also? (only if it’s multi-site)

Under page item:

If the content is specific to page item, then we can structure it under page item as this approach has following advantages:

  1. Makes sure that sitecore tree is clean and related content is always relative to page item.
  2. Child items(related items) follows/inherits the same security permission of the page item.

Outside of page item:

This approach is more inclined towards creating/organizing the contents outside of page item, it can be outside of site or it can be in the same site, but outside of home node, this approach has following advantages:

  1. This helps in content sharing as content created once can be reused in several other page items as well, and not restricted to just one page.
  2. Aims to match the tree structure closely with the site structure, to make it more readable and content editor friendly.

So, we observed here that there are basically two ways we can follow to structure the contents based on the requirement,but there can be sitecore implementation which can use hybrid approach and can follow combination of above two methods.

Configuring Page Items:

So far we discussed only about related content items that can be used in one complete page, but i think what also¬†should think now, can we create sitecore page items outside home node? then the answer is “Yes” and it’s again based on your strategy how you want to architect it.

We can still create page items outside of home node, and use routing to give it a friendly URL, one of the reason we would do this is making sure we are keeping sitecore as clean as possible, and if we see that the sitecore tree has the potential to grow over the period of time, like products/stores or something similar which is directly mapped with external CRM system or any other 3rd part repository, then it add more sense to create it outside of home node.


We discussed different ways and techniques we can use and follow to structure our sitecore content, but which way to go is more client centric and how they are more comfortable also matter sometimes.

I would say we should consider all above options while structuring sitecore content tree,and should do sitecore feasibility study before coming up with a plan.

These are my views and opinions, if anyone has any other thoughts, then please share it and let’s discuss it more, and make it a healthy discussion,please also leave comment¬†below.

Happy learning ūüôā

Sitecore | Shared vs Final layouts

One of the new features of Sitecore 8 is the introduction of versioned layouts.

Language Version Layouts give content editors the ability to create different layout definitions for each language version for an item. In Sitecore 8 there is now a Shared Layout and a Final Layout tab in the presentation details dialogue of an item. This is where the magic for the versioning is configured.

The Shared Layout section stores the renderings that are shared across all language versions of an item, while the Final Layout section, stores the renderings that are specific to the current language version you are editing. The Final Layout details panel displays the final combination of presentation details, and determines what is rendered when viewing the current version of the item.


This new feature allows Sitecore users to design and market pages based on different languages. Content editors can now not only update the datasource on a component based on personalization rules, but can also present a different layout structure, including or removing components per language version.

This gives the content editor and marketing team a wider range of variations. If a multi-language site has a different marketing plan or promotional offers based on the language, marketers are no longer restricted to rendering the same components for all languages. The language version layouts open many doors for a customized user experience.

There are however some things that Sitecore users need to remember about this new tool. Currently there isn’t a way to update the shared layouts field from the Experience Editor.


Question : What layout do you modify when you edit a page in Experience Editor?

Answer: Final Layout

Before Sitecore 8 regardless of item or language version, it used to update the shared layout,as there was no final layout present.when we open a page item we basically create a delta against page template, and will be presented with the page layout with the delta merged which gets updated to _Renderings field.

From Sitecore 8, we still create delta of what we have in the page template, but the page layout will be presented and updated to _Final Renderings field, which is versioned per language.

Please share your feedback and comments, as how we can make this a great learning platform, much appreciated.

Happy learning ūüôā