Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions 10/umbraco-cms/fundamentals/design/rendering-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume

### Specifying types of data

You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
You can specify the type of data being returned to help you format the value for display.

To use the `<IHtmlContent>` as the data return type, add the `@using Microsoft.AspNetCore.Html;` directive.
In our example, we have a string, a date and some rich text:

```html
<h1>@(Model.Value<string>("pageTitle"))</h1>
<div>@(Model.Value<IHtmlContent>("bodyContent"))</div>
<div>@(Model.Value<IHtmlEncodedString>("bodyContent"))</div>
<p>Article date: <time>@(Model.Value<DateTime>("articleDate").ToString("dd/MM/yyyy"))</time></p>
```

{% hint style="info" %}
To use `IHtmlEncodedString` as the typed value, add the `@using Umbraco.Cms.Core.Strings;` directive.
{% endhint %}


### Using ModelsBuilder

```html
Expand Down
10 changes: 7 additions & 3 deletions 13/umbraco-cms/fundamentals/design/rendering-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume

### Specifying types of data

You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
You can specify the type of data being returned to help you format the value for display.

To use the `<IHtmlContent>` as the data return type, add the `@using Microsoft.AspNetCore.Html;` directive.
In our example, we have a string, a date and some rich text:

```html
<h1>@(Model.Value<string>("pageTitle"))</h1>
<div>@(Model.Value<IHtmlContent>("bodyContent"))</div>
<div>@(Model.Value<IHtmlEncodedString>("bodyContent"))</div>
<p>Article date: <time>@(Model.Value<DateTime>("articleDate").ToString("dd/MM/yyyy"))</time></p>
```

{% hint style="info" %}
To use `IHtmlEncodedString` as the typed value, add the `@using Umbraco.Cms.Core.Strings;` directive.
{% endhint %}

### Using ModelsBuilder

```html
Expand Down
10 changes: 7 additions & 3 deletions 14/umbraco-cms/fundamentals/design/rendering-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume

### Specifying types of data

You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
You can specify the type of data being returned to help you format the value for display.

To use the `<IHtmlContent>` as the data return type, add the `@using Microsoft.AspNetCore.Html;` directive.
In our example, we have a string, a date and some rich text:

```html
<h1>@(Model.Value<string>("pageTitle"))</h1>
<div>@(Model.Value<IHtmlContent>("bodyContent"))</div>
<div>@(Model.Value<IHtmlEncodedString>("bodyContent"))</div>
<p>Article date: <time>@(Model.Value<DateTime>("articleDate").ToString("dd/MM/yyyy"))</time></p>
```

{% hint style="info" %}
To use `IHtmlEncodedString` as the typed value, add the `@using Umbraco.Cms.Core.Strings;` directive.
{% endhint %}

### Using ModelsBuilder

```html
Expand Down
10 changes: 7 additions & 3 deletions 15/umbraco-cms/fundamentals/design/rendering-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ Each property in your [Document Type](../data/defining-content/#what-is-a-docume

### Specifying types of data

You can specify the type of data being returned to help you format the value for display, consider the publish date in our example:
You can specify the type of data being returned to help you format the value for display.

To use the `<IHtmlContent>` as the data return type, add the `@using Microsoft.AspNetCore.Html;` directive.
In our example, we have a string, a date and some rich text:

```html
<h1>@(Model.Value<string>("pageTitle"))</h1>
<div>@(Model.Value<IHtmlContent>("bodyContent"))</div>
<div>@(Model.Value<IHtmlEncodedString>("bodyContent"))</div>
<p>Article date: <time>@(Model.Value<DateTime>("articleDate").ToString("dd/MM/yyyy"))</time></p>
```

{% hint style="info" %}
To use `IHtmlEncodedString` as the typed value, add the `@using Umbraco.Cms.Core.Strings;` directive.
{% endhint %}

### Using ModelsBuilder

```html
Expand Down