Creating a Page

Last updated on June 26, 2024.

You can create a page on Insites using one of two ways:

  • Creating a page using the Instance Admin
  • Creating a page via code

The primary objective of this guide is to showcase the process of building a page via code.

Important

A summary of the steps needed to create a page using the Instance Admin are as follows:


  1. Select CMS on the main menu.
  2. Choose Content.
  3. Click on ADD CONTENT and fill out the form fields with your inputs.

For more information on creating a Page using the Instance Admin, please visit our documentation regarding Content.

Prerequisites

To follow the steps in this tutorial, you must have the insites-cli installed, an environment configured, and the codebase set up (or at least have an directory). In addition, you should also understand the concepts behind pages and layouts and be able to deploy your changes to check what you just created:

Steps

Creating a page is a four-step process:

  • Step 1: Create a directory for pages
  • Step 2: Create a page file
  • Step 3: Edit the Page file
  • Step 4: Deploy and check

Step 1: Create a directory for pages

You should place pages into the directory inside .

If you are starting from scratch (without having created the codebase), navigate to the directory you created for the directory inside , then create a directory called inside .

If you have already created the codebase, you can skip this step and locate your directory.

Step 2: Create a page file

Create a Liquid file called in the directory.

Step 3: Edit the page file

Edit the page file.

Find a sample page file with explanations below:

app/views/pages/index.liquid

Explanation:

  • Pages have an optional parameter , which indicates where the page will be accessible. marks the root page, which is the homepage.
  • separate configuration from content.
  • is derived from the file name; in this case, it is . Since that's the default, the file could also be named .

Save your page file.

Step 4: Deploy and check

Deploy or sync your changes, and check the source code of your homepage. The layout file with the page content injected into it is like this:

Next Steps

Congratulations! You have created a page file. Now you can add new pages at custom URLs: Adding a New Page at a Custom URL

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.