Javascript

Javascript

{{ javascript }}

Name Type Description
object_type String Will always be datastore_item
is_valid Boolean True if this references a published javascript
guid String The unique identifier for this javascript
value String Contains the same value as guid
name text The name of the javascript which, when combined together with the path, uniquely identifies the javscript on this site
path String The path, exluding filename, of this javascript used for organizational and reference purposes
script code The source code for the script
url String The full public URL for this javascript in the CDN
parse_liquid Boolean When true, indicates that this javascript should be parsed and rendered using liquid markup before being stored in the CDN for future reference
pre_includes javascripts Additional javascript objects to bundle together and output before the current script
post_includes javascripts Additional javascript objects to bundle together and output after the current script
minify Boolean When true, specifies that the current script should automatically be minified before being output
script_compiled String The final result of bundling, compiling, and minifying this javascript object
field_id String The identifier for this field
label String The label for this field
output String Adds the javascript to the document head, similar to calling {% add_javascript %} with it

{{ javascripts }}

Contains multiple scripts.

Name Type Description
output String The default output that the javascripts will produce when it is output directly to the template - using the "output_in_list" property of each javascript in the items list

{% javascript %}

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

{% javascripts %}

{% javascripts
var|set|assign
 
Optional. Specify either "var", "set" or "assign" to change which scope this javascripts is stored on. "var" is the default behavior.
variable_name
 
Specify a variable name in order to save this javascripts to a variable. If not specified, it will be output to the template instead.
output_to_template
 
If included the javascripts will be output directly to the template.
=
prepend:value
 
Prepend the specified javascripts before the fetched results. All prepended input will be returned in the same order that it is input. Value may one or more javascripts, a guid, or a string.
append:value
 
Append the specified javascripts after the fetched results. All appended input will be returned in the same order that it is input. Value may one or more javascripts, a guid, or a string.
exclude:value
 
Prevent the specified javascripts from being included in the fetched results. Has no affect on prepended and appended items. Value may one or more javascripts, a guid, or a string.
exclude_prepended:true
 
Specifically exclude all prepended javascripts 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 javascripts 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 javascripts. 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".
%}