Relatude Help

10 Razor Pages

A Razor Page is named by its path below Pages/. Its handler gets the page through [FromContent], and the @page directive needs no route of its own.

// Pages/Landing.cshtml.cs, from RenderRazorPage<ILandingPage>("Landing") or a Razor Page template
using Microsoft.AspNetCore.Mvc.RazorPages;
using MySite.Models;
using Relatude.DB.CMS.Web.Rendering;

public class LandingModel : PageModel {
    public ILandingPage? Landing { get; private set; }

    public void OnGet([FromContent] ILandingPage? page) => Landing = page;
}
@* Pages/Landing.cshtml *@
@page
@model LandingModel

<h1>@Model.Landing?.Headline</h1>