Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

Master page is useful for sharing common layout and content across multiple email templates. Use master page for CSS, header and footer text, company logo not only improves the consistency in the email presentation but also reduces the maintenance effort of the templates.

A master page typically has the following elements. The @RenderBody() is required and it is replaced with the email content when the template is rendered.

<html>
<head>
    <style>
        <!-- Global CSS -->
    </style>
</head>
<body>
    <p>
        <!-- Header text -->
    </p>
    <div>
       @RenderBody()
    </div>
    <p>
        <!-- Footer and logo -->
    </p>
</body>
</html>

How to create a master page

  1. Navigate to the /comms/templates URL to create a new page.

  2. Enter the name of the template. The name cannot contain space.

  3. Select the Razor template type and Master page type.

  4. Complete the body html.

  5. Save the template.

How to use a master page

  1. Select the template content page.

  2. Add the Layout = "<master page name>.cshtml" inside the @{ } block, as indicated below. Add the @{ } block if it doesn’t exist in the content page.

Please refer to this link for more detail about layout and content pages: https://learn.microsoft.com/en-us/aspnet/core/mvc/views/layout?view=aspnetcore-7.0

  • No labels