An implementation in DynamicWeb is the process of setting up the platform and creating the frontend experience that customers and users interact with. DynamicWeb brings together CMS, eCommerce, PIM, and Marketing in one platform, but every project needs a storefront: the visible layer where content, product data, and commerce functionality come together.
This part of the documentation focuses on building that storefront with server-side rendered Razor templates. It explains the core concepts you need as a frontend developer and points you to the articles that go into detail.
Choosing an implementation direction
DynamicWeb 10 supports three implementation directions. Each balances speed, flexibility, and customization in a different way:
| Method | Description | Effort & Skillset | Advantages & Considerations |
|---|---|---|---|
| Swift | A prebuilt, configurable storefront accelerator designed for quick deployment. Provides a mobile-first, performance-optimized template set for standard B2B and B2C sites. | Low to moderate effort. Most setup is configuration-based rather than code-heavy. Editors can manage layout and design visually; developers extend where needed. | Fastest time to market and includes best practices for SEO, accessibility, and performance. Ideal for standard webshops and rapid implementation. Less suited for deeply custom designs, as customizations may require in-depth Swift knowledge. Low maintenance compared to From Scratch. |
| From Scratch | Build a design from the ground up, templates and layouts, without using prebuilt designs or components. Ideal when you need a completely unique storefront or have very specific design and behavior requirements. | High effort. Requires advanced frontend (HTML, CSS, JavaScript) and Razor skills, as well as an understanding of the DynamicWeb template system and ViewModels. | Offers complete flexibility and control over layout, design, and functionality. However, it can be time-consuming and lacks prebuilt conveniences. Best suited for teams with strong technical expertise and large, custom projects. |
| Headless | A fully decoupled, API-driven approach that separates the frontend (e.g., React, Vue, Next.js) from the DynamicWeb backend. Uses APIs to deliver data for total freedom in presentation and user experience. | High effort. Requires advanced frontend development, API integration, and state management skills. Developers must handle e.g. routing, cart logic, and user context manually. | Maximum flexibility and scalability, perfect for omnichannel and app-driven projects. Can be complex to build and maintain, with more responsibilities for caching, performance, and integration. Best for advanced teams or large-scale digital ecosystems. |
This section focuses on building a design from scratch with the DW10 template engine: a clean-slate starting point where you create your own templates.
The same concepts apply when you customize Swift. The other two implementation methods are documented elsewhere:
Setting up a developer environment
To implement a DynamicWeb 10 solution using the DW10 template system you need:
- A DynamicWeb 10 solution installed locally
- An IDE for template development which supports Razor, e.g. VS Code or Visual Studio
- Experience with HTML, CSS, and JavaScript
- Experience with Razor
- A basic understanding of DynamicWeb and its concepts
Apart from that, the frontend stack can be anything you like. You can use Git, Node.js, npm, bundlers, TypeScript, minifiers, and other build tools, as long as the output ends up in your design folder.
To install a solution locally, follow one of these guides and then the local frontend development section in the guide:
For more advanced setups see the Environments article.
How a page is rendered
When a visitor requests a page, DynamicWeb finds the page in the content tree, decides which templates to use, renders each of them with a ViewModel, and combines the output into one HTML document. Understanding this flow is the key to working with DynamicWeb templates.
A page is made of templates nested inside each other. Each template has its own ViewModel and only knows about its own part of the page:
- A master template holds the markup most pages share: the
<head>, CSS and JavaScript, the header, the navigation, and the footer - A layout holds the markup of one kind of page, e.g. frontpage, blog post, or shop, and decides where editors can add content
- Row templates render the rows editors add to a grid, with one or more columns each
- Paragraph templates render the content blocks in placeholders or grid columns, e.g. text, image, or a custom teaser
- App templates render the output of an app attached to a paragraph, e.g. a product list or a login form
The templates are rendered from the inside out. Apps run first, then each paragraph template is rendered with the app output ready in GetModuleOutput(), then the row templates place the finished paragraphs in their columns. Only then is the layout rendered, merged with its master into one template. When the layout calls @Model.Grid() or @Model.Placeholder(), the content is already finished HTML.
This order explains a few things you will meet in practice:
- A paragraph or app template can add CSS and JavaScript with
AddScript(), and the master still writes it in the<head>, because the master is rendered last; a layout cannot, because it is merged into the master and runs after the<head>is written - A template only sees its own ViewModel; a paragraph template cannot read variables from the layout, and a layout cannot change how a paragraph is rendered after the fact
- An app can end the request before the page is rendered at all, e.g. with a redirect after a form is submitted
The layout decides where editors can add content and how. This is called the content model: a layout can define placeholders, a grid of rows and columns, or render a fixed set of fields from the page itself. See Content models for the details.
Each page uses one layout. DynamicWeb uses the layout selected on the page, then a layout inherited from a parent page, then a layout made for the page's item type, and finally the default layout of the website. Paragraphs are resolved in a similar way, with a template selected on the paragraph or a template named after the paragraph's item type. Layouts and master templates and Paragraphs and paragraph templates describe the two lookups.
The design folder
All templates are stored as files in the Templates folder of your solution. A collection of templates and static files that controls how the frontend of a website looks is called a design. You can have multiple designs on a solution, each in its own folder under Files/Templates/Designs:
/Files/
├── Templates/
│ ├── Designs/
│ │ ├── myDesign/
│ │ │ ├── Assets/
│ │ │ │ ├── css/
│ │ │ │ ├── js/
│ │ │ ├── Grid/
│ │ │ │ ├── Page/
│ │ │ ├── Navigation/
│ │ │ │ ├── TopNavigation.cshtml
│ │ │ ├── Paragraph/
│ │ │ │ ├── Default.cshtml
│ │ │ │ ├── Teaser.cshtml
│ │ │ ├── Master.cshtml
│ │ │ ├── Layout_default.cshtml
│ │ │ ├── BlogPost.cshtml
The folder names Paragraph and Grid are conventions DynamicWeb relies on when it looks for templates, so keep them as they are. Layouts are the .cshtml files in the root of the design folder. Apps have their own subfolders, e.g. eCom/ProductCatalog or Users, which are described in the articles for each app. Assets can be organized any way you like.
A design is connected to a website by selecting one of its layouts as the website's default layout in the website settings. From then on, pages in that website can only use layouts from the same design.
The templates are plain files, so the design folder is what you keep in source control and deploy. Item type definitions are files too, in /Files/System/Items, and are usually deployed with the design.
The Designs section explains the design folder in detail, and the tutorial walks you through creating a design, a layout, a master template, and a navigation from scratch.
Using Razor in templates
Razor is a markup syntax for embedding .NET code into web pages. Templates are .cshtml files containing HTML, Razor markup, and C#. They are compiled the first time they are used and recompiled automatically when you save a change, so you do not need to restart or build anything while you work on them.
Here is an example of a layout template:
@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.PageViewModel>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@Model.Title</title>
</head>
<body>
<h1>Welcome to the page '@Model.Name'</h1>
</body>
</html>
The @inherits line tells DynamicWeb which ViewModel the template expects, here a PageViewModel. The ViewModel is available as @Model, so @Model.Name is replaced with the name of the page being shown and @Model.Title with its meta title.
The result of the rendering would be this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DynamicWeb - CMS, PIM and Ecommerce</title>
</head>
<body>
<h1>Welcome to the page 'Home'</h1>
</body>
</html>
DynamicWeb Razor templates differ from ASP.NET Core MVC views in a few ways that are worth knowing up front:
- Templates are files in the solution's
Filesfolder, not part of a compiled project, and there are no controllers; DynamicWeb decides which template to render and which ViewModel to pass - A layout uses a master template with
@MasterPageFile("Master.cshtml"), and the master marks where the layout goes with@ContentPlaceholder() - Output is not HTML-encoded:
@valuewrites the string as-is, which is why rich text fields render as HTML; encode plain text yourself where it matters, e.g. withSystem.Net.WebUtility.HtmlEncode()
Showing dynamic content
There are two ways to get data from DynamicWeb into a template:
- ViewModels: type safe, perform better, and give you IntelliSense in your IDE
- TemplateTags: older, being phased out, but still used in some template contexts
Use ViewModels for all new templates.
ViewModel templates
A ViewModel-based template starts by inheriting a context-specific ViewModel, here a ProductListViewModel. You can then use @Model to access the properties of the ViewModel:
@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Ecommerce.ProductCatalog.ProductListViewModel>
<h1>@Model.Group.Name</h1>
<ul>
@foreach (var product in Model.Products)
{
<li>@product.Name (@product.Price.PriceWithVatFormatted)</li>
}
</ul>
The ViewModel depends on what the template renders. These are the ones you meet first:
| Template | ViewModel |
|---|---|
| Master and layout | PageViewModel |
| Paragraph | ParagraphViewModel |
| Grid row | GridRowViewModel |
| Navigation | NavigationTreeViewModel |
| Apps | App-specific, e.g. ProductListViewModel for the product catalog |
You can find all ViewModels in the API reference, and many of them are explained in the articles in this part of the documentation.
TemplateTag templates
A tag-based template uses loops and Get-methods to fetch content based on TemplateTags:
@inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
<h1>@GetString("Ecom:ProductList:Page.GroupName")</h1>
<ul>
@foreach (LoopItem product in GetLoop("Products"))
{
<li>@product.GetString("Ecom:Product.Name") (@product.GetString("Ecom:Product.Price.PriceWithVATFormatted"))</li>
}
</ul>
To see which TemplateTags are available, call the @TemplateTags() helper somewhere in the template. It renders a table in the frontend with the available tags, loops, and values for the context. You can read more about the TemplateTags system on our old documentation site.
Where to go next
With the concepts above in place, the rest of this part of the documentation follows the order you typically build a solution in:
- Designs: build the frame of the website, with layouts, a master template, navigation, CSS, JavaScript, colors, and fonts
- Content: decide what editors can build, with content models, paragraphs, grid rows, and item types
- Apps: add product catalogs, user management, forms, and other functionality
- Page-based emails: build newsletters and marketing emails from content pages
- SEO and discoverability and Production setup: prepare the solution for search engines, AI agents, and real traffic
Extensibility
By default, ViewModels contain the properties we regard as necessary for each template. If you need to add custom properties to a ViewModel, see Extending ViewModels.
Keep performance in mind when you do. To avoid slow templates, follow these guidelines:
- Do not put business logic, e.g. price calculations, in templates; use other extensibility points such as custom providers
- Avoid extension methods for code that is only used once; it moves the code out of the template, which makes the template harder to understand and update
- Templates are rendered many times, so too many API calls or too much C# code in a template can cause performance issues