Templating - Variables
About
Variables in Combostrap are first-class citizen meaning that you can use them anywhere.
Example
Without Transformation
The below markup will print:
* Title: ''$title''
* Path: ''$path''
Output
- Title: The variables that can be used anywhere
- Path: :docs:templating:variable
With pipeline transformation
You can transform the variable by using the pipeline syntax
It will create:
- a link
- with a pipeline
- that separate the h1 with the minus -
- and used the second part as link description
The [[$path| ${h1 | cut("-","2-") | trim()} page]].
Result:
Variable List
The supported variable are:
- path is the full qualified path of a page that can be used in a page link as reference
- title - the title of the page - if empty, the h1
- lead - the lead of the page (tagline)
- name - the name of the page - if empty, the last part of the id
- h1 - the h1 title (the first header text of the page) - if empty, the title.
- description - the description - a long description
- label - the label - a short description
- keyword - the page keywords
- date_created - the creation date
- date_modified - the modification date
- date_published - the publication date
- date_start - the start date of an event
- date_end - the end date of an event
- word_count - the number of word in a page
- backlink_count - the number of backlinks
- type - the type of page
- is_low_quality - a boolean that is set to 1 if the page is of low quality
- lang - the lang of a page
- is_index - a boolean that is set to 1 if the page is a index page
- slug - the slug of the page
- level - the level of the page in the file system tree
- depth - the maximum difference between the level of the current page and the selected page (page sql only attribute)
- now - the actual date (note that if the page is cached, the now date will be the date of the rendering)
And all frontmatter metadatas that are scalar (ie no array). Basically, all metadata that can be seen in the scalar metadata node of the analytics data can be used as attribute.
Value
By default all variables are filled with the value of the requested page.
When used inside a iterator fragment, they get the values of the selected page.
Parent Variable
You can retrieve parent page data with the hierarchical breadcrumb.