Sitecore for Developers
Add custom widget to Sitecore's Launchpad
12/26/2018
Periodically, we get requests to add a component or widget to Sitecore's Launchpad. It's usually exposing information from a third-party system or providing quick access to data that may be buried deeply in Sitecore's content tree. Although this is not a difficult task, it does require several changes.
Prerequisites
- Sitecore 8.1 update-3 (this may work on other versions, but it's only been tested on Sitecore 8.1 update-3 as of this writing)
- Visual Studio with Sitecore Rocks installed
- You will also need to set up a connection to your Sitecore instance with Sitecore Rocks
Implementation
1. Add rendering for component
First, you'll need to create a rendering that will be presented in the Launchpad. I chose to use a Controller Rendering to keep this rendering consistent with my front-end renderings for this application.
-
- In the core database, add a new controller rendering below /sitecore/client/Applications/Launchpad/PageSettings/Renderings (template is at /System/Layouts/Controller rendering)
- Fill in the necessary fields for your rendering (Controller, Controller Action, Area, etc.)
- If necessary, create the controller, action method, and view that you referenced in your Controller Rendering
- Build and deploy your updates to your Sitecore application
Example controller
HelloWorldController.cs
public class HelloWorldController : SitecoreController { public ActionResult HelloWorld() { // TODO: Here's where your logic goes to gather whatever information you'd like to display return View("HelloWorld", (object)"Hello, world!"); } }
Example view
HelloWorld.cshtml
@model string@if (!string.IsNullOrEmpty(Model){ <h1 style="color: red; font-weight: bold;">@Model</h1>}
2. Update Launchpad to include your new rendering
- In Visual Studio, open Sitecore Rocks' Sitecore Explorer
- Expand your Sitecore instance's core database down to the /sitecore/client/Applications/Launchpad item
- Right-click and select Tasks -> Design Layout from the context menu
- Show the properties window (View -> Properties Window)
- Note: At this point, you will need to decide where on the Launchpad you would like to add the component. I decided to put mine to the right of the main dashboard of tiles (LaunchTiles), but you can fiddle around with the layout and put yours wherever you prefer.
- Select ColumnPanel1, find the GridColumns property, and change it to 9
- Select the LaunchTiles rendering below ColumnPanel1 and click the Add Rendering button in the top left corner of the tab
- In the resultant dialog, find and select the ColumnPanel rendering and click OK
- After you ensure that your new rendering (ColumnPanel2) is selected, find the PlaceholderKey property and change its value to RowPanel1.Content
- Click the Add Rendering button again, this time finding and selecting your new rendering and clicking OK
- After you ensure that your custom rendering is selected, update its PlaceholderKey property value to ColumnPanel2.Content
- Click Save
3. Preview your handiwork