In Umbraco, we can customise the user experience in several different ways. One handy feature to allow content editors to add re-usable components onto a page is to implement custom macros in your project. In case you haven't run into macro's before, a macro is a reusable piece of code that developers can build into an Umbraco project, that allows content editors to add into any rich text block that's defined on any document type within the site.
When we define a macro, we can define one or more parameters to be associated with it. When a content editor drops the macro into a text area, they can populate these parameters which can be used to render the macro. There are two types of macros in Umbraco, partial view macros (via code) and XSLT macros. It is best practice to only use partial via macros and this is the option we will explore in today's tutorial.
var parameter = Model.MacroParameters["customParamter"];
Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge