JustNik

Removing default Dashboards in Umbraco v8

Umbracologoblue05

When you fire up a clean install of Umbraco it comes with some default dashboards. Most of these are really useful for your clients/editors, however a couple you might want to remove. The main one that people often want to remove before they release a site to their clients is the "Getting Started" dashboard that shows up in the Content section.

In Umbraco v7, removing these was a trivial exercise based around editing the old Dashboards.config file, however in Umbraco v8 this now requires a small bit of code. Personally, I still feel this is a trivial exercise but if you aren't familiar with Compositions and the way v8 works you might not feel the same way.

The following is a "simple" composer that can be added to any Umbraco v8 project and it should remove 2 default dashboards for you, the Getting Started dashboard and the Settings dashboard. Both of these, I feel, should be removed before a client get's their hands on a site.

using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Web;
using Umbraco.Web.Dashboards;

namespace YourWebsite
{

    [RuntimeLevel(MinLevel = RuntimeLevel.Run)]
    public class SetupComposer : IUserComposer
    {
        public void Compose(Composition compositions)
        {
            composition.Dashboards().Remove<ContentDashboard>()
                .Remove<SettingsDashboard>();
        }
    }
}

So there you have it, a quick and "easy" way of removing two of the default dashboards.

JustNik
Connect with me
Twitter GitHub LinkedIn
© JustNik 2024