9

I would like to delete the Home from master database. I can delete without any problem but I saw for example references in site configurations. Is there any other places where should I remove the references?

7

It is safe to delete the default Home item. I have done so on many projects.

The only place where you need to update the reference is the default site definition:

<site 
  name="website"
  ...
  rootPath="/sitecore/content"
  startItem="/home"
  ... />

Some system sites, such as "shell" and "modules_website", also have references to the Home item. In most cases they won't be used, but it's still best to change them to point to an existing item.

  • Unfortunately that's not enough. Sitecore assemblies maybe use the startItem and contentStartItem, and if it's not existing maybe things can go wrong. For example the Sitecore.UiUtil GetHomeItem method uses and checking the length of it. – Tamás Tárnok Nov 10 '16 at 9:55
  • @TRNKTMS What are the circumstances in which this becomes a problem? – Dmytro Shevchenko Nov 10 '16 at 10:43
  • When I try implement this functionality - jammykam.wordpress.com/2014/04/24/…. To inject js/css into Content Editor. If I don't remove the contentStartItem for the shell site then it does not injecting the script. Strange but works like this... – Tamás Tárnok Nov 10 '16 at 10:49
  • @TRNKTMS: I never had issues with that... but makes sense to change it since the shell site has master set as the content database. – jammykam Nov 11 '16 at 9:32
3

You need to check the default site definition and your custom site definition nodes in the config file. It must not include /home path as start path and master as a database.

You don't need to care about modules_website as it is not using the Master database.

And regarding the Sitecore.UIUtil.GetHomeItem method, it won't create any issue. If it can't find the path /sitecore/content/Home it will return the Item till /sitecore/content.

  • Sitecore.UIUtil.GetHomeItem could issue if the contentStartItem is not an existing item because then it returns with null and it's checking the length of the setting - if (obj == null && site.ContentStartItem.Length > 0). – Tamás Tárnok Nov 10 '16 at 14:15
2

I would like to answer my own question because I found out and tested the exact answer. Of course thank you for the answers. So here is the patch configuration what I used to remove all references to the default Home item from the default Sitecore configuration.

<sitecore>
    <settings>
        <setting name="DefaultItem">
            <patch:attribute name="value">/</patch:attribute>
        </setting>
    </settings>
    <sites>
        <site name="shell">
            <patch:attribute name="startItem">/</patch:attribute>
            <patch:attribute name="contentStartItem">/</patch:attribute>
        </site>
        <site name="modules_website">
            <patch:attribute name="startItem">/</patch:attribute>
        </site>
        <site name="website">
            <patch:attribute name="startItem">/</patch:attribute>
        </site>
    </sites>
</sitecore>

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.