Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

"Shortcoding?" Pulling in Blocks into any other module/page doesn't display block content or code. How to?


In other CMS' i've worked in, there is an option to either insert a Block into a text field/RTF  WYSIWYG or by copying a "shortcode" into the fields you want it to generate in.

For example:    ...would display anything in this CMS from a page to a block of code with or without a view.

In Episerver, it feels like this:    ...should amount to a view or model of code within item? But all i get is a description text, seen between the


Does episerver have any sort of shortcode luxury? Something i missed in documentation review? 

Sep 06, 2016 19:32

How do you render the WYSIWYG property on your page?

Like this:


Like this:

@Html.PropertyFor(m => m.MainBody)

Or like this:

@Html.DisplayFor(m => m.MainBody)

The first example will not parse and render blocks. The other two will, by rendering the XhtmlString with the HTML Helper extension RenderXhtmlString. 

Edited, Sep 07, 2016 9:00
<p>You can drag n drop blocks (and pages) to your rich text editor as well as restrict it to only allow particular page/block types. As long as you render it using&nbsp;</p> <pre class="brush:html;auto-links:false;toolbar:false" contenteditable="false">@Html.PropertyFor(m =&gt; m.MainBody)</pre> <p>like Mattias is saying above you are safe. That's also why it's recommended to actually pass along the current page into the view model like they do in Alloy to keep it simple. Then you get some nice things like that for free. It's possible to solve otherwise too but a little boring... :)</p> <p>Happy coding!</p>
Sep 07, 2016 10:05

Yeah, and you can also define a property on your view model with the same type and the same name as on your content model if you don't want to pass in the current page. Actually it's not required to have the same name on the view model property but it makes things easier. Otherwise you would have to add edit hints to connect the content model property with the view model property.

Sep 07, 2016 10:16

Oh, btw, if you want to render XhtmlStrings in a context where you don't have a HTML helper available you can look at my reply here:

Sep 07, 2016 10:51

Nope...all foreign to me. I have access only to Episerver itself. No compiles, no solutions, no nothing. Thanks anyway for your collective helps!

Sep 09, 2016 3:56

Oh ok, this is the developers forums :). Maybe you can forward this information to the agency that developed the solution you are editing?

Just to make one thing clear:

Based on the markup you are referring to it looks like HTML generated directly in the Wysiwyg editor. Episerver doesn't support real time block preview at the time you are editing a Wysiwyg property. They are parsed and loaded when you remove focus from (blur) the editor.

Sep 09, 2016 8:47
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.