---
title: Migrate from Razor to DotLiquid
slug: configured-commerce/docs/migrating-from-razor-to-dotliquid-in-classic
docTags: 
createdAt: 2026-08-13T10:46:21.000Z
---

:::hint{type="warning"}
**Important**

Classic CMS reached end-of-life in January 2025 and is no longer receiving feature updates or bug fixes. You should \[migrate to Spire CMS]\(../../End user docs/spire-cms/get-started-with-spire-cms/migrate-from-classic-cms-to-spire-cms.mdx).
:::

You can run some regular expressions in Visual Studio to do some of the tedious work required for larger views.

## Basic Razor variables

When migrating an existing Razor view to DotLiquid all **@Model** references need to be replaced. In general, anything of the form **@Model.Variable** can be converted to **\[\[Model.Variable]]**.

**Regex to change these in VS**

1. Find: @(?Model.(\[\w.]+))?
2. Replace: \[\[Model.$1]]

## Basic control structures

@if can be converted to \[% if %] \[% else %] \[% endif %]

@foreach can be converted to \[% for x in Y %] \[% endfor %]

When doing blocks like **if and for**, ending them with **-%]** will cause them to not be a blank link in the rendered HTML.

See [GitHub](https://github.com/dotliquid/dotliquid/wiki/DotLiquid-for-Designers) for more information about the basic DotLiquid syntax.

If there is complicated logic in the Razor view, it will need to be moved into the **ContentItemModel**.

If any properties on the **ContentItemModel** are not basic types, they need to return something that derives from Drop, or a list of something that derives from Drop.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/JTQZdUS3ZEpjXn6tW7TPO_18a595b-razortodotliquid-derivesfromdrop.png)

### Zones

@Html.Zone(Model, "\[ZoneName]") can be converted to \[% zone 'ZoneName' %]

### URLs

@Url.ContentPage\<\[PageType]>() can be converted to \[% urlForPage '\[PageType]' %]

**Regex to change these in VS**

1. Find: @(?Url.ContentPage\<(.\*)>())?
2. Replace: \[% urlForPage '$1' %]

@Url.Action needs to be converted into the real URL, and then \[% urlFor '\[url]' %] - this will take microsites into account.

### Messages

@Html.Message("\[MessageName]", "\[DefaultValue]") can be converted to \[% siteMessage '\[MessageName]' %]

When doing this, ensure that **MessageProvider** contains a property **\[MessageName]**, if it does not, add it, and move the default value from the razor view into the **MessageProvider** property

**Regex to change these in VS**

1. Find: @Html.Message("(.*?)",.*?)
2. Replace: \[% siteMessage '$1' %]
3. Find: @MessageProvider.Current.(\[a-zA-Z\_-]\*)
4. Replace: \[% siteMessage '$1' %]

If any have site messages, translate, and a string format.

1. Find: @string.Format(MessageProvider.Current.(\[a-zA-Z\_-]*), T("(.*?)"))
2. Replace: \{\{\::'\[% siteMessage '$1' %]'.replace('', '\[% translate '$2' %]')}}

### Translations

@T("Translated String") can be converted to \[% translate 'Translated String' %]

:::hint{type="info"}
**📘 Note**
Some translations have an extra pair of parentheses @(T("Translated String")) wrapping the call to the translation function. The regex handles that as well.
:::

**Regex to change these in VS**

1. Find: @(?T("(.\*?)"))?
2. Replace: \[% translate '$1' %]

### Themed Partials

@Html.ThemedPartial("/Views/Directives/Folder/File.cshtml") can be converted to \[% translate 'Folder-file' %]

**Regex to change these in VS**

1. Find: @Html.ThemedPartial("/Views/Directives/(\[a-zA-Z\_-]*)/(\[a-zA-Z\_-]*).cshtml")
2. Replace: \[% partialView '$1-$2' %]

### Popups

@Html.Action("GenericPopupPartial", "Shared", new \{ containerName = "popup-deletewishlist", BodyHtml = Model.DeleteWishlistMessage, Title = @T("Delete Wishlist") })

Needs to be switched to:

```xml
<isc-popup-template title="[% translate 'Delete Wishlist'%]" container-id="popup-deletewishlist">
  [[Model.DeleteWishlistMessage]]
</isc-popup-template>
```

### Razor Helpers

@helpers can sometimes be converted into captures, as long as they aren't passed in parameters.

![](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/okxSiZ8iV_qgKHqRXtMN3_627fdba-razortodotliquid-helpers.png)
