Include Other Twig Templates

Last updated

This page is archived

We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.

Alternate resources

Sprout Video

Using a base layout is very common, and we’ve implemented that in the previous tutorial. Sometimes you also need to include some other templates on only select pages. In this tutorial you are going to add a sales banner to the pages using the include function, and working with the variables we can pass there.

Additional resources

Be sure to check the documentation for the version of Twig in your codebase for the correct syntax and usage.

  • Documentation for include function: 1.x | 2.x | 3.x