Relatude Help

Editors decide: templates

Templates need no code. A template renders by its kind: a view template renders its view, a controller template its action, and a Razor Page template its page (chapter 5). A kind of your own renders as you say (below). A page without a template gets the template made for its type: the one whose NodeTypes is closest to the page's type, chosen the same way as code defaults.

So when every page of a type looks the same, one template for the type is enough. To let editors choose, make more than one template for the type. A page must then choose, since neither template is closer than the other:

templates "article" and "article-wide", both for IArticle

an IArticle with Template = "article-wide"   → ArticleWide.cshtml
an IArticle with Template = "article"        → Article.cshtml
an IArticle with no template                 → error: both fit equally, so the page has to choose

The CMS refuses to save such a page without a template, so editors see the problem, not visitors.