Table of Contents

Content / @Content Object

The Content is a Dynamic Entity in all Dynamic Code (Razor and WebAPI).

It contains the content-item assigned to this template. If the View is a list, then Content contains the first item in the list. Note that if the View is configured to be a list, then it may also have a Header.

⚡ The official API docs.

Since it's a Dynamic Entity it carries all values as properties, like Content.Link etc.

Discover More in the Razor Tutorials

We have an rich series of Razor tutorials. You should really check them out 👍.


Example Razor Code

<div>
  @Content.Name
</div>

Content.Presentation

Depending on the view configuration the Content can carry additional presentation information, for example how to format the title etc. This is available on Content.Presentation. The Presentation object is also a Dynamic Entity.

<div class="@Content.Presentation.Highlight">
  @Content.Name
</div>

Demo Data

Note that the View can be configured to contain demo data for both the Content as well as the Content.Presentation. In this case your template will receive data to show even if the editor has not added anything.

History

  1. Introduced in 2sxc 1.0
  2. Presentation added in this documented form ca. 2sxc 8