As you know Razor is the ASP.NET view engine. I have already posted an introduction to Razor in my blog. Now let’s talk about the concept of Razor in Umbraco. Umbraco team has considered Razor in their version 4.6 onwards and it’s robust in version 4.7 of Umbraco.
We already knew the importance of XSLT in Umbraco as we use it for creating the lists, navigations, breadcrumbs and iterating through the Umbraco nodes etc. Razor is optimized around HTML generation in a code focused approach. Razor can be used in scenarios where we can use XSLTs. We can exploit the skills of .NET developers with Razor as it works well with C# or VB knowledge. The Razor source code has extension either .cshtml/.vbhtml. We can use Razor scripting either in template via Macro or directly inside the HTML templates inside Umbraco.
Lets brief the advantages of using Razor scripting is as follows
- Compact, Expressive and Fluid
- Easy to learn
- Not a new language
- Works with any text editor
- Great intellisense in Visual Studio.
We can use Razor scripting in Umbraco either as inline scripts, we can access Umbraco property data, work with macro parameters, list sub pages from current page, list subpages by level etc. You can watch for more posts in Razor with Umbraco in coming days.
For further information please visit the http://umbraco.com/help-and-support/video-tutorials/umbraco-fundamentals/razor/introduction-to-razor-in-umbraco
No comments:
Post a Comment