Umbraco - Web Developer Skinning Documentation
Umbraco - Web Developer Skinning Documentation
Umbraco Skins
Creating a skin for Umbraco
Umbraco
12/23/2010
This document walks through the different components of a skin for Umbraco. It is based on the Umbraco
Simple Starter Kit which serves as a simple base for applying your own skins. Important note: The
descriptions and screen shots in this document are preliminary, based on a beta version, and are subject to
change prior to final release.
Contents
About Skins ........................................................................................................................................................ 4
How do Skins Work in Umbraco? .............................................................................................................. 4
What Can a Skin Change? .......................................................................................................................... 4
How Do You Customize a Skin? ................................................................................................................. 5
Changing Skins ........................................................................................................................................... 6
Advanced Skins .............................................................................................................................................. 7
The Structure of a Skin .................................................................................................................................. 9
What Does a Skin Package Contain? ......................................................................................................... 9
Supported Website Starter Kits ................................................................................................................... 10
Applying a Skin from the Installation Wizard .............................................................................................. 11
Creating Skins .................................................................................................................................................. 12
Steps to Create a Skin .................................................................................................................................. 12
Required Files .......................................................................................................................................... 12
The Skin Manifest .................................................................................................................................... 13
Optional Files ........................................................................................................................................... 16
Packaging the Skin ................................................................................................................................... 16
Testing the Skin ........................................................................................................................................... 16
Submitting the Skin to the Repository ........................................................................................................ 17
Enabling a Starter Kit to Support Skins .................................................................................................... 17
Walkthrough: Creating a Skin for Simple Starter Kit ...................................................................................... 18
Step 1 – Install the Starter Kit Developer Package .................................................................................. 18
Step 2 – Create a Stylesheet .................................................................................................................... 18
Step 3 - Modifying the Template HTML .................................................................................................. 18
Step 4 - Preparing and Packaging the Skin ............................................................................................. 18
Step 5 - Testing a Skin .............................................................................................................................. 19
Advanced Skin Tasks .................................................................................................................................... 19
Altering Template Markup ...................................................................................................................... 19
Allowing for User customization of a Skin ............................................................................................... 20
Reference......................................................................................................................................................... 22
Dependency Types ...................................................................................................................................... 22
Text .......................................................................................................................................................... 22
Image ....................................................................................................................................................... 22
By default, skins can be applied to the Umbraco Starter Kits; Simple, Blog, Personal, and Business. In order
to apply or change a skin, the user simply navigates to the Settings section, selects the Master Template,
then clicks the Modify Template Skin button. Umbraco will launch the Skin Customization dialog in the
Canvas Editing mode.
Skin Example
For example, in the default Starterkit.Master Template contains this markup:
A skin might add a <div> element to apply a particular style to the navigation sections, as below:
Notice in both cases the markup remains unchanged with the exception of the <div> added by the skin to
apply a particular style to the given element, in this case the umbTopNavigation macro rendered output.
In each case the underlying Document Types and Content remain unchanged. In order to apply the skin,
the user only needs to select the desired skin from the Skin dashboard in the site’s Settings section. The
markup, styles, and images associated with the skin are automatically applied by Umbraco.
The dialog will contain input fields for any custom properties the skin contains.
Changing Skins
By clicking on the change skin link the user can easily select a different skin available for the current
Template, or remove the skin by selecting the I prefer not to install a skin link. By clicking the customize
link the user is returned to the customize skin dialog above.
An advanced skin can contain one or more templates which will be used in place of the existing templates.
Although the recommended approach is to use a pure-CSS approach, there may be times when applying a
new Template to the site is advantageous; such as when there are many HTML changes to be made. In this
case, a skin may apply a new .master Template to the site. This Template (or Templates) will replace the
default site Templates, though Umbraco will create a backup of the original site Templates to allow the skin
to be rolled back easily.
Notice in both cases the id of the Content Placeholder, cp_top, remains unchanged as do the Umbraco
content items,”siteName” and ”siteDescription”, and the Umbraco ”umbTopNavigation” macro. In
addition, the skin applied also contains an image and a different layout structure than the default Starter
Kit skin.
The default Starter Kit Template above renders a page similar to this:
CSS files
JavaScript files
Images
A skin manifest
Optionally, one or more .master Template files
Sub folders can be used to organize content
Skinname_sitename.css
For a skin named “GoBlue” to be applied to the “Starterkit” site the skin’s CSS file would be named:
GoBlue_starterkit.css
Best practice is to keep the number of CSS files for a skin to only one.
/scripts/GoBlue/script.js
In the skin folder, the script file can be in the root or in a sub folder.
By hovering over a starter kit icon the starter kit’s description will be displayed. By clicking a starter kit icon
the starter kit will be installed. The user can select the I prefer not to install a starter kit link to continue the
installation without installing a starter kit.
One a starter kit has been installed, the configure your site screen will display where the user can select an
available skin to apply to the starter kit. As above, by hovering over a skin icon the skin’s description will be
displayed. By clicking a skin icon the skin will be installed. The user can select the I prefer not to install a
skin link to continue the installation without applying a skin to the installed starter kit. In this case, the
starter kit’s default skin will be applied.
Required Files
For a skin, only a CSS file to be used in place of the default CSS and the skin manifest are required.
However, best practice is to include the skin’s styles in a separate CSS file, to store the site’s images in a sub
Skin Information
Under the <Skin> root are the required elements which should be set for each skin.
<Skin>
<Name></Name>
<Author></Author>
<Version></Version>
<Description><![CDATA[]]></Description>
The <Name> property should be unique per skin as this will be used by Umbraco to display the available
skins to the user.
<AllowedDocumentTypes></AllowedDocumentTypes>
<AllowedRootTemplate></AllowedRootTemplate>
<SkinPalette></SkinPalette>
<Dependencies>
<Dependency type="Image" label="Please chose your logo image">
There are two types of dependencies; Image and Text, and two types of tasks; ModifyCSS and
ModifyTemplate. Using these in combination a custom property can be used to update a logo image in a
Template or update a “background” class in a CSS file, among many other possible uses.
ModifyCSS Task
The modify CSS task updates the specified target file with the specified value as defined by the properties
of the dependency.
ModifyTemplate Task
The modify template task updates the specified target file with the specified value as defined by the
properties of the dependency.
<Task type="ModifyTemplate">
<TargetFile>Textpage.master</TargetFile>
<TargetID>logo</TargetID>
<TargetAttribute>src</TargetAttribute>
<Value>${Output}</Value>
</Task>
AddStyleSheetToTemplate Task
The AddStyleSheetToTemplate task will append a link tag to the head element of the specified file and can,
optionally, add the media attribute.
<Task type="AddStyleSheetToTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<Media>screen</Media>
<Value>${Output}</Value>
</Task>
The AddStyleSheetToTemplate task will append a link tag to the content area that is linked to the
ContentPlaceHolder with the id cp_content.
<Task type="AddStyleSheetToTemplate">
<TargetFile>Homepage.master</TargetFile>
<TargetSelector>//*[@ContentPlaceHolderID = 'cp_content']</TargetSelector>
<Media>screen</Media>
<Value>${Output}</Value>
</Task>
Using the AddStyleSheetToTemplate task, it is also possible to create tasks that will be executed on
installation of a skin. These tasks should be defined in the /Skin/Install element of the skin manifest and
have a fixed value.
Optional Files
In addition to the above files, a skin may also include Template files which will be used in place of the site’s
default Templates. These are the standard .master HTML Template files and should have the same file
name as the site’s default Templates they target for replacement. Best practice when creating .master
Template files is to use the same layout in terms of the Template’s Content and Contentplaceholder
structure as the site’s original Templates.
If a skin contains .master Template files, Umbraco will use these in place of the site’s default .master
Template files when the skin is applied to the site. Umbraco will create a backup of the original Template
files for later use; if the skin in uninstalled or a different skin applied the backup files will be used for the
site’s Templates.
css
scripts
images
These sub folders should be created under an Umbraco site’s /masterpages/<skin name>/ folder.
The recommend approach is to use the Umbraco Package Creator located in the Developer section to select
the skin’s folders and files and to create the .zip file. Using the Umbraco Package Creator a readme text can
be included as well as the license to be applied to the skin package.
<enableSkins>true</enableSkins>
Add a link element to the StarterkitMaster template fot the created stylesheet, just below the included
Starterkit.css reference:
With these items in place the skin specific stylesheet can be edited to change the appearence of the Starter
Kit site,this is the ”skin.” A basic HTML outline of the a Starterkit page is located at the end of this
document.
Including Images
Best practice for including images with your skin, is to create a dedicated folder for them under /css/. All
images will be found under a common path such as /css/SkinName/img01.jpg and the stylesheet can
refernce them directly with a relative path like so:
Background: url(SkinName/img01.jpg);
However, best practices for a Starterkit site skin is to not modify the Starterkit templates but, instead, to
accomplish the desired skin changes exclusively with CSS.
1. Create a new folder under the /masterpages/ folder, so you have path like /masterpages/BigBlue/
2. Copy the sample skin.xml file from the skin documentation to the newly created folder. It is
important that the file be named skin.xml.
3. Edit skin.xml
18 umbraco.org | Walkthrough: Creating a Skin for Simple Starter Kit – Beta | Umbraco I/S
a. Update the name, author and description properties, leave the allowedTemplate set as:
StarterkitMaster.
b. Navigate to the <install> section. By default a "AddStyleSheet" task is added to the list.
Modify the stylesheet name to the skin’s CSS file name, /css/BigBlue_starterkit.css.
i. This will ensure that Starterkit gets your new stylesheet included in the html
With skin.xml file updated, the skin is complete. In order to allow a skin to be redistributable,it needs to be
contained in a package containing the files and folders for the skin. To create a skin package, follow these
steps:
1. From the Umbraco instance, navigate to the Developer section, expand Packages and right-click on
Created Packages, select Create, input the skin package name, and click Create
2. From the Package Files tab, add the following folder and files
a. /css/BigBlue_starterkit.css
b. /masterpages/BigBlue/
c. /css/BigBlue/images/
3. From the Package Properties tab fill in all the property values
4. Click the Save an Publish button to publish the skin package
When the skin package is published, the skin can be downloaded as a .zip file that can be installed on any
system with a Starter Kit installed.
To un-install the skin, click the Edit Skin button, de-select the skin, and click Apply. The skin will be
uninstalled and the default Starterkit skin will be applied.
For this example we will continue to work in folder structure created in the previous section. The above
tasks are pre-requisite for this section, so be certain to complete the above example first before continuing.
19 umbraco.org | Walkthrough: Creating a Skin for Simple Starter Kit – Beta | Umbraco I/S
A skin with HTML changes, overrides the default Starterkit Templates, and creates a backup of the original
Templates.
Based on the default Starterkit Templates, it is easy to recognoize the various Content Placeholders and
thier positioning.
When the HTML of the skin’s Template files is complete, and the site renders as expected in the browser,
the altered Template files can be included in the skin package.
To include Template in a skin package, copy the completed Templates to /masterpages/BigBlue/ so they
are located in the same folder as the skin.xml file.
Following the packaging step from abov, the skin’s Template files are now automatically included in the
package when the package is published.
Dependency
This defines the type of dependency (image, text, etc...)
Dependency Task
These are tasks performed based on the value entered for the dependency by the user and can be tasks like
modifying a stylehsheet, adding HTML to a Template or adding content to a page
<Task type="ModifyTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<TargetID>siteName</TargetID>
<Value>${Output}</Value>
</Task>
20 umbraco.org | Walkthrough: Creating a Skin for Simple Starter Kit – Beta | Umbraco I/S
Dependency Example
You wish to allow the user to modify the company name. To do this you add a dependency of the type Text
to the skin.xml:
Now that you’ve specified a company name, you need a task to process it. In this case we update the
StarterkitMaster Template with the user specified compnay name:
<Task type="ModifyTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<TargetID>siteName</TargetID>
<Value>${Output}</Value>
</Task>
Additonal tasks can be added to a dependency so the user specified value can be used to update multiple
Templates or CSS files. The complete xml added to skin.xml will be:
<Tasks>
<Task type="ModifyTemplate">
<TargetFile>Textpage.master</TargetFile>
<TargetID>logo</TargetID>
<Value>${Output}</Value>
</Task>
</Tasks>
</Dependency>
21 umbraco.org | Walkthrough: Creating a Skin for Simple Starter Kit – Beta | Umbraco I/S
Reference
This section contains the reference for all dependency and task types.
Dependency Types
Text
Renders a text input box.
Image
Renders a file upload control and allows optionally specified dimensions. If dimensions are specified, an
image cropper will be rendered.
Fixed Size
Color
Renders a color picker.
Option
Renders a drop down list input control.
Slider
Renders a jQuery slider control
Task Types
ModifyCSS Task
The modify CSS task updates the specified target file with the specified value as defined by the properties
of the dependency.
<Task type="ModifyCss">
<TargetFile>Style.css</TargetFile>
<TargetRule>#logo</TargetRule>
<TargetParameter>background</TargetParameter>
<Value>no-repeat url( ${Output} )</Value>
</Task>
<Task type="ModifyCss">
<TargetFile>starterkit.css</TargetFile>
<TargetRule>#companyname</TargetRule>
<TargetParameter>color</TargetParameter>
<Value>${Output}</Value>
</Task>
<Task type="ModifyCss">
<TargetFile>starterkit.css</TargetFile>
<TargetRule>#company</TargetRule>
<TargetParameter>background-image</TargetParameter>
<Value>url(${Output})</Value>
</Task>
ModifyTemplate Task
The modify template task updates the specified target file with the specified value as defined by the
properties of the dependency.
<Task type="ModifyTemplate">
<TargetFile>Textpage.master</TargetFile>
<TargetID>logo</TargetID>
<TargetAttribute>src</TargetAttribute>
<Value>${Output}</Value>
</Task>
ModifyTemplate Examples
<Task type="ModifyTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<TargetID>companyname</TargetID>
<Value>${Output}</Value>
</Task>
<Task type="ModifyTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<TargetID>companyname</TargetID>
<TargetAttribute >src</TargetAttribute >
<Value>${Output}</Value>
</Task>
AddStyleSheetToTemplate Task
The AddStyleSheetToTemplate task will append a link tag to the head element of the specified file and can,
optionally, add the media attribute.
<Task type="AddStyleSheetToTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<Media>screen</Media>
<Value>${Output}</Value>
</Task>
AddStyleSheetToTemplate Example
The AddStyleSheetToTemplate task will append a link tag to the content area that is linked to the
ContentPlaceHolder with the id cp_content.
<Task type="AddStyleSheetToTemplate">
<TargetFile>Homepage.master</TargetFile>
<TargetSelector>//*[@ContentPlaceHolderID = 'cp_content']</TargetSelector>
<Media>screen</Media>
<Value>${Output}</Value>
</Task>
Install Tasks
Using the AddStyleSheetToTemplate task, it is also possible to create tasks that will be executed on
installation of a skin. These tasks should be defined in the /Skin/Install element of the skin manifest and
have a fixed value.
<Install>
<Task type="AddStyleSheetToTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<Value>/css/<skin name>/style.css</Value>
</Task>
<Task type="AddStyleSheetToTemplate">
<TargetFile>Homepage.master</TargetFile>
<TargetSelector>//*[@ContentPlaceHolderID = 'cp_content']</TargetSelector>
<Dependencies>
<Dependency type="Text" label="Company name">
<Properties>
<Output></Output>
</Properties>
<Tasks>
<Task type="ModifyTemplate">
<TargetFile>StarterkitMaster.master</TargetFile>
<TargetID>companyname</TargetID>
<Value>${Output}</Value>
</Task>
</Tasks>
</Dependency>
<Dependency type="Color" label="Company name color">
<Properties>
<Output></Output>
</Properties>
<Tasks>
<Task type="ModifyCss">
<TargetFile>Starterkit.css</TargetFile>
<TargetRule>#companyname</TargetRule>
<TargetParameter>color</TargetParameter>
<Value>${Output}</Value>
</Task>
</Tasks>
</Dependency>
<Dependency type="Image" label="Header">
<Properties>
<Output></Output>
<Height>150</Height>
<Width>600</Width>
</Properties>
<Tasks>
<Task type="ModifyCss">
<TargetFile>Starterkit.css</TargetFile>
<TargetRule>#company</TargetRule>
<TargetParameter>background-image</TargetParameter>