O'Reilly logo

Umbraco User's Guide by Paul Sterling, Nik Wahlberg

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

INTRODUCTION TO UMBRACO MACROS

In order to introduce custom functionality and specialty output to your Umbraco site, you will need to know about macros. A macro is essentially a callable action that executes a predefined chunk of code. This code can be made up of the following technologies/languages:

  • .NET C# and VB User Controls
  • .NET Custom Control (Server Control)
  • XSLT Template
  • IronPython, LOL Code, Ruby, and more

Macros are created in the Developer section image Macros node. You can create one using the following steps:

  1. Navigate to the Developer section in the backoffice, found at http://<install domain>/umbraco.
  2. Right-click Macros, then click the Create menu option, as shown in Figure 5-1.

    FIGURE 5-1

    image

  3. Select the .NET User Control, XSLT template, or other code source and save your Macro.

Figure 5-2 shows a “bird's-eye-view” of how to create macros in Umbraco, giving an overview of the fields and functions, which are described in Table 5-1.

image Umbraco will create the Alias automatically by concatenating the Name value, stripping out spaces and special characters.

In addition to creating the macro manually, you can specify that your XSLT file automatically generate the macro and preselect ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required