Speed! - Sitecore Rocks - part 1

As those who know me will testify, I am a bit of a speed freak. I like running fast, driving fast, reading fast and of course developing quickly too!
In the following blog series I am going to show my favourite efficiency tips for speeding up your Sitecore development.

I have used Sitecore Rocks for many years now, and I would not want to develop without it. Not having to switch interfaces between the Content Editor in the browser and Visual Studio is, of course, saving you time already. Sitecore Rocks was primarily built to help developers work faster, so it has lots of time saving features built-in.

Use Commandy

Sitecore Rocks is so powerful that the contextual menus have too many options. It is sometimes hard to remember exactly where a particular function is. Was Set Icon under Tasks, or Tools? Commandy helps by giving you access to the contextual menus from the keyboard, always faster than clicking with the mouse, and also by allowing you to search through the whole list of available contextual menu options.

Commandy can be invoked through the contextual menu itself, but also, more usefully, through Ctrl+Shift+Space.

Picture of commandy

If you type enough in the filter box to have a single entry selected, you can then press enter to execute that command. No need to leave the keyboard.

The goodness of Commandy does not stop there though. It has some hidden modes. Clicking on the arrow on the top right will show you what they are and how to invoke them.

Different commandy modes

Lets say you start typing "n " (letter followed by a space). Instead of showing contextual menu options, it will now let you search through the list of all the available templates. You can select the template, provide a name in the next pop up, and it will create an item.

If you use "i " instead, it will only show those templates assigned to the insert options. Explore all the other modes: search (locate an item in the Sitecore explorer), edit (use search to open an item for editing), workflow, etc.

The set base templates mode only works when selecting a template. Beware that it will override any selected base templates with whatever new entry you choose.

Setting menu favourites

Commandy will allow you to spend less time searching through the contextual menus. However there are times when you do want to use the mouse instead of the keyboard. For those cases you can modify the menus to promote certain commands as favourites. If you hold Ctrl+Shift when right clicking to open the menu, you will see some star icons beside each entry. Toggling those stars will add that command to the top of the contextual menu, setting it as a favourite.

Ctrl+Shift contextual menu

You could for example, have publish item and related items set as favourite.

added publish as a favourite

Use keyboard shortcuts

If you want to go fast there is no better way than using keyboard shortcuts extensively. Alt+Insert to create items, Ctrl+Enter to open presentation details, etc. Shortcuts were massively changed between Rocks 1.x and 2.x.
You can also easily modify the shortcuts using the same trick shown for adding favourites in the contextual menu. As well as showing the star icons, it also shows a keyboard icon to alter the shortcut for that function.

Use the correct folder templates

You should always create a folder structure for all the custom items you create in Sitecore: templates, rendering definition items, media items, etc. It is easy to succumb to the temptation of just creating folders i.e. items based on the Common/Folder template. Rocks can make you fall into this trap, as it has an option in the contextual menu to create a folder. You will make your life easier if you create the folder using a more specific template. Use the Template Folder template when in the templates area, or the Renderings Folder when you are creating definition items for your components.
The easiest way is to use the trick shown above. Let's say you need to create a new folder for your renderings:

  1. select the sitecore/layout/Renderings item
  2. press Ctrl+Shift+Space to open commandy
  3. type 'i \'
  4. type 'f' \
  5. provide name for folder

By using the correct template, you can leverage the insert options in the same manner when creating definition items later.

As an aside: Sitecore also provides another way of achieving the same specifity of insert options whilst keeping the generic Folder template using Rules. In fact Sitecore follows that approach in some parts of the tree, for example the Goals area of the Marketing Center. When you create a Folder there, it also shows Goal and Goal Category as insert options. If you want to see why that happens check the /sitecore/system/Settings/Rules/Insert Options/Rules/Goals item.

Contextual menus everywhere

Remember contextual menus are not just available in the Sitecore Explorer and the Item Editor. For example, when editing presentation details, you can right click on a component and locate the item in the Sitecore Explorer. The same applies inside Treelist fields for example.