Use Partials
Partials are Mustache template files that are included in a page, similar to an include, import, or a nested template. Weebly sites use partials as a way to easily organize and find different parts of the website. You can edit these partials to change how their contents display.
Tip: Remember that 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 automatically display based on the type of content being displayed on the page, such as a product or a blog. Any page can use each of your different templates.
You can also create your own partials so that you don't have to repeat code (which can be a nightmare to maintain). Change the partial and the change is reflected everywhere it's used.
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.
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.
In this topic:
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:
Mustache Tags
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 Theme 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.
Note: Do not change any classes or IDs used in a partial, as changes may affect the behavior of the site
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:
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:
Edit Partial to Style the Date
Now, wherever that partial is used, the blog date will display in red.
Note: All themes use the same default partials. Only customized partials are downloaded when you export a theme. So if you want to work in an external tool and want to change a partial, make a small change first in the Weebly editor, and then export the theme to work externally.
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:
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 }}