x First time here? Check out the FAQ

Umbraco Best Practices

    This section covers the best practices with naming conventions when it comes to naming conventions, particularly when aiming to use packages or creating your own.

    General rule of thumb is if it contains fields/settings (DocTypes, Macros) then it should be PascalCase, if it is a field/setting (umbracoNaviHide, bodyText) then it should be lowerCamelCase.

    Naming Conventions

    TypelowerCamelCase / PascalCase ...Examplenotes
    Document Type Alias PascalCase AboutUs Names should be singular, not plural.
    Document Type Property Alias lowerCamelCase bodyText Don't use dots in your names, it causes JS errors with some packages.
    Template Alias PascalCase ContactUs  
    Media Type Alias PascalCase Video  
    Media Type Property Alias lowerCamelCase runningTime  
    Macro Alias PascalCase BreadcrumbTrail  
    Macro Property Alias lowerCase imageCount  
    Physical Files (xslt, css, scripts) lowerCamelCase breadcrumbTrail.xslt  
    XSLT include files prefixed with a underscore and lowerCamelCase _settings.xsl Not everyone will use these but stole the Rails convention of using an underscore to show a file which is included by other xslt files. Nicely seperates them and all your includes are listed first.
    Anything mentioning Id's It should be "Id" not "ID" memberId, customerId, hotelId Umbraco uses this convention for everything so keep it simple and adopt it
    XSLT local variables/parameters lowerCamelCase imageCount A local variable is one that is declared within a xsl:template so only has scope within that template
    XSLT global variables/parameters PascalCase.lowerCamelCase Settings.cacheTime Global variables should be namespaced with the same name as the file they are declared in. Globals are variables/parameters declared outside a xsl:template and are available to any templates with in that file or any parent file that includes it. By namespacing you reduce the likely hood of name clashes and make it a breeze to work out where variables are declared if you use xsl:includes. $currentPage is the only exception to this one as its "special".

     

    Conventional field names

    Some field names have become convention and some are just build into Umbraco from the off. Listed here are some of the field names you should use:

    bodyText - The name for the main chunk of text on any given page, normally a Rich text editor

    See the links on the right for all the build in "umbraco" fields that you should be using too.

    Related forum posts:

    our.umbraco.org/forum/templating/templates-and-document-types/5303-Best-Practises---Naming-conventions?p=0#comment33553