---
title: Displaying shared content in MVC applications
related:
  - https://docs.kentico.com/k9/developing-websites/defining-website-content-structure/page-types/advanced-content-modeling.md
  - https://docs.kentico.com/k9/managing-website-content/working-with-pages/modeling-content-by-reusing-pages.md
  - https://docs.kentico.com/k9/developing-websites/developing-sites-using-asp-net-mvc/developing-mvc-applications/working-with-page-attachments-in-mvc-applications.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

You can display the [reusable content](https://docs.kentico.com/k9/developing-websites/defining-website-content-structure/page-types/advanced-content-modeling.md) added by [content editors](https://docs.kentico.com/k9/managing-website-content/working-with-pages/modeling-content-by-reusing-pages.md) in your MVC application's views. The shared content, created by adding pages in the _Pages_ form control\*,\* is accessible via a field that's part of the [code generated](https://docs.kentico.com/k9/developing-websites/developing-sites-using-asp-net-mvc/developing-mvc-applications/generating-classes-for-kentico-objects.md) for individual page types.

## To display reused content in your MVC application

1. [Perform the initial set up](https://docs.kentico.com/k9/developing-websites/developing-sites-using-asp-net-mvc/starting-with-mvc-development.md) of your MVC application.
2. Reference the page types that you want to access in your view using the _@model_ directive:

   ```csharp

   @using CMS.DocumentEngine.Types;
   @model Article
   ...

   ```
3. Access the individual related pages stored in the view.\
   **Note** that by default, the pages are accessed in the same order in which they are [added by content editors on the Form tab](https://docs.kentico.com/k9/managing-website-content/working-with-pages/modeling-content-by-reusing-pages.md).

   ```csharp

   // Create a list of individual pages stored in the 'Pages' page type field named 'ContentItems'
   @{ var pages = Model.Fields.ContentItems.ToList(); }

   @if (pages.Any())
   {
       ...
       // Iterate over each of the pages of a specific type in the same order in which they are added on the Form tab
       @foreach (var article in pages.OfType<Article>())
       {
           ...
           // Display the image stored in the page's 'Teaser' field
           <img src="@Url.Kentico().Attachment(article.Fields.Teaser) class="article-tile-image" />
           ...
       }
   }

   ```

> **Tip:** See our [MVC Demo site](https://github.com/Kentico/Mvc) for a showcase of using this approach to display an article containing content added via the _Pages_ field.
