Include files are similar to assets in that they are considered global and editing the include file updates all the pages that are using it. The main difference is that include files are hardcoded into particular locations within the page templates, whereas assets can be placed in any editable region, allow flexibility around where they appear.
Include files are text files typically with an extension of .inc that get referenced by another page or file and included on that page or called by that file. The content can include text, script, HTML elements such as unordered lists and forms, or even variables to be called by a TCF. Include files are generally found at the site root within a folder called _resources/includes/. The obvious benefit is that rather than editing the same content multiple times to update it, it can be updated once in the include file and the files using it are updated as well.
There are any number of ways that include files can be used.
- As a header or footer file that includes the recurring text for a site
- As a header or footer file that includes a navigational element for a site
- As a secondary header or footer file that includes a navigational element across sites for an institution
- As a file including images or text unique to a page on the site
- As left or right sidebars containing, gadgets, widgets, ads, or banners
- As a file containing a specific form to be used for a search query input
- As a file that includes a social media link bar
- With a TCF to include code snippets
Include files are generally hardcoded into a particular location of the templates. For instance, headers appear at the top of the page, side navigation files appear in the same location on every page, and widgets are generally placed in a particular page location, and are not editable through each individual page’s editable regions.
It is possible to configure page properties for a page so that the include file being called can be changed on a page-by-page basis, but the location of the include stays the same. The includes are also edited once, published, and the changes appear on all pages including them.
It is also possible to use include files to make editing TCF variables easier. If multiple TCFs include the same variable sets, the variable sets can be placed in an include file and included in the TCFs. Then if the variables need to change, the include file simply needs to be updated.