Inline Code - Create a Masterpage Template

A layout file includes your HTML declaration, head, and body as well as links to any JavaScript or CSS files. Page Templates in Agility will default to using the standard "_Layout.cshtml" file in your MVC Application, however it you'd like Agility Page Templates to use an Inline Code file as the Masterpage, you'll need to create a Template to function as your Masterpage.

  1. Create a new Template in Inline Code (see Inline Code - Create a Template)

  2. Scaffold your HTML to include the following important Agility Placeholders:

    <!doctype html>
            <meta name="viewport" content="width-device, initial-scale=1.0">
            <!-- Use the Agility Page's Title as the document title -->
            <!-- Agility Placeholders, to output top scripts,
                meta tags/keywords/description and additional header markup -->
            <!-- Reference another Inline Code Template for the Header -->
            <!-- Instruct the MVC Application to load your Page Template here -->
    	<!-- Agility Placeholders, to output bottom scripts -->
  3.  Optionally, reference other files you have in Inline Code using the following format:

    <!-- Reference other Inline Code CSS Files -->
    <!-- Reference another Inline Code Template for the Header -->
    <!-- Reference another Inline Code JS file -->
  4. Next, you'll need to set this as your Masterpage layout file for any of your relevant Page Templates. These Page Templates can exist in Inline Code or within code in the MVC project. At the top of the file add the following line of code:

    @{ Layout = Html.AgilityTemplatePath("Masterpage"); }
0 out of 0 found this helpful



Please sign in to leave a comment.