Skip to content

Using Partials with NodeJS

Original guide · All levels

What are Partials Wappler allows you to create and reuse partials in your NodeJS Projects. Partials are useful when you want to create reusable components and include them in some of your pages. Unlik

Wappler allows you to create and reuse partials in your NodeJS Projects. Partials are useful when you want to create reusable components and include them in some of your pages. Unlike the content which you include in your layout pages, which is used across all the pages using this layout, partials can be included on just some of your pages.
You can include anything inside a partial - a navbar, a banner, a contact form, an image gallery etc.

We have already created a layout and a page from it:

We’d like to include a partial on our page.
There are two ways to create a partial - creating a new partial from scratch or moving an existing content/component from a page to a partial.

We’d like to create a banner, which shows some promo image and add it to several of our pages.
Select Partials in the Pages Manager:

Your partial will be loaded in Design View. Select App in the App Structure panel and select your layout page from the dropdown. This way the partial will know where to add any includes if required:

And we enable the responsive option for the image:

Section titled “And we enable the responsive option for the image:”

Save your page and you are done. Now let’s add this partial on your page(s).

Section titled “Save your page and you are done. Now let’s add this partial on your page(s).”

Open a page where you want to use this partial on. Click the add element button, where you need to add the partial:

And select your partial from the dropdown:

Section titled “And select your partial from the dropdown:”

And you can see your partial included on the page:

Section titled “And you can see your partial included on the page:”

This way you can include your partial on any page.

Section titled “This way you can include your partial on any page.”

You can move any content from your page to a Partial and then reuse it on your other pages.

Select the element/component which you want to move to a Partial (1) and click the Move to Partial button (2):

And you are done! Your partial appears in the Partials menu of the Pages Manager:

Section titled “And you are done! Your partial appears in the Partials menu of the Pages Manager:”