Partials are Mustache template files that are included in a page, similar to an include, import, or a nested template.

You don’t determine where partials display in your templates. Your templates only determine the layout of the large blocks of content, like headers, banners, footer, and sections. Partials and their content automatically display based on the type of page being rendered, such as a product or a blog.

Partials can render some variables and even render each other. For example, in addition to its own content, the blog post partial can reference the date (a variable) as well as render the blog comment section’s partial. You can change the order that sub-partials display on the parent page. For example, on the product page in some themes, the social icons display below the price. In other themes they display below the Add to Cart button.

Editing a Weebly Partial

Partials are written in a template engine called Mustache. They are a mix of regular text or HTML plus some Mustache-specific markup. Here’s a simple example:

Hello {{name}}
You have just won <b>{{value}}</b> dollars!

Here, {{name}} and {{value}} are variables and at runtime are replaced by actual data (check out the About Mustache topic for more info, or visit the Mustache site). Partials only support the variables currently used on them. Also note that not all partials are available to edit.

Weebly partials can be accessed from the Code Editor. There are partials for blogs, commerce, membership, navigation, and search. You can edit the partials directly and add HTML, styling, or even another partial.

​For example, say you want to change how the blog date is displayed. By default, the blog/post.tpl partial contains the blog date, as shown here:


<p class="blog-date">
    {{{date_html}}}
</p>

Say you want to change it so that it displays in red. You might add style="color: red;" to the <p> tag that contains the date:

    
<p class="blog-date" style="color:red;">
    {{{date_html}}}
</p>

Now, wherever that partial is used, the blog date will display in red.

Partial Maps

Use these topics to understand where Weebly partials are used in a site. Each topic outlines the partial’s display area in blue, with a brief description of what that partial displays.

Partials are used in these areas:​

Creating a Custom Partial

You can create a custom partial for inclusion in a Weebly partial. Create your custom partial using HTML. You can use the same variables that the parent partial uses.

Save your partials using the .tpl extension. Once you create a custom partial, you include it in another partial using this syntax: {{> example_partial }}


Help make these docs better!









Tags: