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
Navigate to the /comms/templates URL to create a new page.
Enter the name of the template. The name cannot contain space.
Select the Razor template type and Master page type.
Complete the body html.
Save the template.
How to use a master page
Select the template content page.
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