Code First Document Types and How To Create Blocks Within Umbraco

WATCH IT ON YOUTUBE: https://www.youtube.com/watch?v=lPOh-2XqH00

Today's questions were asked by Nicola Ayan.

My two questions are:

  • Is there an Umbraco equivalent to Episerver blocks? Does that concept exist at all in Umbraco? My web content authors need to be able to create page sections that they can reuse on other pages and sort amongst each other. I’ve looked at macros and grid editors but these do not suffice.

  • Can I build the document types in code and Umbraco to generate these in the database the next time it runs, like Episerver? I don’t like to merge the content and content types in the database for obvious reasons.

In this episode, I answer these questions. First, as long as you are using Umbraco 7.8 then everything is possible and it's all built into the core product.

First code first can be achieved by implement the Umbraco Models Builder.  A good overview can be found here: https://24days.in/umbraco-cms/2016/getting-started-with-modelsbuilder/

The closet like-for-like to Episerver code-first feature in Umbraco is uSiteBuilder.  uSiteBuilder t hasn't been updated for a while but it still works with Umbraco 7.8.  As there's a built-in Models builder, I recommend using that though.  For reference, uSitebuilder tutorial can be found here:

http://jondjones.com/learn-umbraco-cms/umbraco-developers-guide/umbraco-packages/how-to-build-an-umbraco-7-document-types-in-visual-studio-usitebuilder-explained

Another great plug-in I recommend that cab help deployment, is uSync:

http://jondjones.com/learn-umbraco-cms/umbraco-developers-guide/umbraco-packages/how-to-sync-your-umbraco-7-content-using-usync

If you want to use Episerver block like functionality within your website. You should look at the Grid Layout data type. This useful document type allows content editors to be able to split a page layout into columns and rows. You can set the width of your grid components and it's definitely worth checking out!

https://our.umbraco.org/projects/developer-tools/umbraco-grid-renderers/

Jon D Jones

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

Back to top