Add_stylesheet

Add_stylesheet

{% include %}

Processes and outputs a partial template, javascript, or stylesheet.

If the partial template is a compiled template, then any custom fields from the partial template will be available in the parent template as well.

The path is significant when including objects. Every template, javascript, and stylesheet has a path, even if that is the root path (/). The location of the path to be included will always be based off of the path of the current object. So including 'header' from a template at the path '/pages' will attempt to process '/pages/header' while the same include from a template at the root path - which would attempt to process '/header'.

You always have the option of using an "absolute path" when including templates by beginning your included template name with '/'. Eg: {% include '/header' %} or {% include '/partials/header' %}. Absolute paths ignore the path of the current template when determining what partial to include.

You can also navigate up the directory structure using '../'. So including '../partials/header' from a template at the path '/agency/pages' will attempt to process '/agency/partials/header'.

{% stylesheet %}

{% stylesheet
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this stylesheet is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this stylesheet to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the stylesheet will be output directly to the template.
=
%}

{% stylesheets %}

{% stylesheets
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this stylesheets is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this stylesheets to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the stylesheets will be output directly to the template.
=
prepend:value
 
Prepend the specified stylesheets before the fetched results. All prepended input will be returned in the same order that it is input. Value may one or more stylesheets, a guid, or a string.
append:value
 
Append the specified stylesheets after the fetched results. All appended input will be returned in the same order that it is input. Value may one or more stylesheets, a guid, or a string.
exclude:value
 
Prevent the specified stylesheets from being included in the fetched results. Has no affect on prepended and appended items. Value may one or more stylesheets, a guid, or a string.
exclude_prepended:true
 
Specifically exclude all prepended stylesheets from the fetched results. If "unique:true" is specified this is the default behavior, although you may also specify "exclude_prepended:false" to allow any prepended items to be fetched along with other results anyway.
exclude_appended:true
 
Specifically exclude all appended stylesheets from the fetched results. This is false by default - even if "unique:true" is specified - so that results are returned in the proper order.
unique:true
 
If set to true, each of the resulting lists (prepended, fetched, appended, and items) will be unique, although there may be duplicates between the prepended, fetched, and appended lists. The "items" list will include objects in the order in which they appear - with prepended items first, then fetched items, then appended items.
max_size:number
 
If specified, then the "items" list will only include up to the specified number of stylesheets. The "limit" may be automatically lowered to only fetch the maximum number of articles that will be included in "items" following prepended items. Note that this may also impact both the "page" and "total_pages" values. In order to use pagination with a list loaded using "max_size" use "start" instead of "page" and "limit".
%}

{% add_stylesheet %}

Add a stylesheet asset to the head of the current page via a <link> tag

{% add_stylesheet inline %}

Outputs an inline stylesheet in a <style> tag.

Examples

Add Stylesheet

Copy
{% add_stylesheet "Bootstrap" %}

Add inline stylesheet

Copy
{% add_stylesheet inline xxkr_footer_frompage %} //Use your imagination here! #footer { background-color: '{{entity.footer_background_color}}'; color: '{{entity.footer_text_color}}'; } {% end_stylesheet %}

Include template and pass variables

Copy
{% search searchCollection "keyword" limit:10 page:search-page %} {% for result in searchCollection %} {% include "search-result" item:result %} {% endfor %} {% include "pagination" collection:searchCollection style:"links" max_links:5 %}