Partials are a very important part of the LemonStand CMS engine. Partials allow for the reuse of code across Templates, Pages and even in Partials themselves. For example, you could create a partial that contains a list of applicable documentation links that you would want to include on a number of support/contact related pages on your website. Rather than inputting the code for these links in the content area of each page, you can simply reference the partial that contains the markup for your links.

For example:

{{ partial("document-links") }}

For learning purposes, let's create a simple partial that will display the current date. Then we will render it on our Hello World! page. Click the Editor link on the sidebar to bring up the Editor section, then click on the Partials menu item. You will now see a list of all the partials in the system. Click the '+' button to begin adding a new partial.

In the Code field, let's give our partial a name. Enter current-date into the field.

For the Description field, let's enter This partial outputs the current date.

In the Content field, copy and paste following code:

<p>Today is {{"now"|date("F,j")}}</p>

Your 'Add Partial' page should now look like the following:

Hit Save & Close. Let's now set our newly created partial to render as part of our Hello World! page. Navigate to the Pages section by clicking on Pages under the Editor menu. Then find our 'Hello World!' page and click on it to edit. In the Content section, paste the following code to the bottom of the code.

{{ partial("current-date") }}

Your page content should now look like the following:

it Save & Close and then load the Hello World! page in the browser. You should now see the current-date partial rendered as part of the page.