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 ...

Get Umbraco User's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.