---json { "canonical": ":template:variable", "description": "This page describes which variables you can use in your content.", "page_id": "fr74w67bja6teikjevzlc", "title": "The variables that can be used anywhere" } --- ====== 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: * a [[docs:lists:list|bullet list]] * with the variables: [[docs:page:title|title]] and [[docs:page:system:path|path]] of the actual page. * Title: ''$title'' * Path: ''$path''
**Output**
==== With pipeline transformation ==== You can transform the variable by using the [[:docs:templating:pipeline|pipeline syntax]] It will create: * a [[docs:content:link|link]] * with a [[docs:templating:pipeline|pipeline]] * that separate the [[docs:page:h1|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 [[:docs:page:system:path|full qualified path of a page]] that can be used in a [[docs:content:link|page link]] as reference * ''title'' - the [[:docs:page:title|title]] of the page - if empty, the ''h1'' * ''lead'' - the [[:docs:page:lead|lead]] of the page (tagline) * ''name'' - the [[:docs:page:name|name]] of the page - if empty, the last part of the id * ''h1'' - the [[:docs:page:h1|h1 title]] (the first header text of the page) - if empty, the ''title''. * ''description'' - the [[:docs:page:description|description]] - a long description * ''label'' - the [[docs:page:label|label]] - a short description * ''keyword'' - the [[docs:page:keywords|page keywords]] * ''date_created'' - the creation date * ''date_modified'' - the modification date * ''date_published'' - the [[docs:page:published|publication date]] * ''date_start'' - the start date of an [[docs:type:event|event]] * ''date_end'' - the end date of an [[docs:type:event|event]] * ''word_count'' - the number of word in a page * ''backlink_count'' - the number of [[docs:navigation:backlink|backlinks]] * ''type'' - the [[docs:type:type|type of page]] * ''is_low_quality'' - a boolean that is set to 1 if the page is of [[docs:quality:low_quality_page|low quality]] * ''lang'' - the [[docs:styling:lang|lang]] of a page * ''is_index'' - a boolean that is set to 1 if the page is a [[docs:page:system:index|index page]] * ''slug'' - the [[docs:page:slug|slug]] of the page * ''level'' - the [[docs:page:level|level]] of the page in the file system tree * ''depth'' - the maximum difference between the [[docs:page:level|level]] of the current page and the selected page ([[docs:templating:sql|page sql only attribute]]) * ''now'' - the actual date (note that if the page is [[:docs:cache:page|cached]], the ''now'' date will be the date of the rendering) And all [[docs:metadata:frontmatter|frontmatter metadatas]] that are scalar (ie no array). Basically, all metadata that can be seen in the [[docs:analytics:data|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 [[docs:templating:iterator|iterator fragment]], they get the values of the selected page. ===== Parent Variable ===== You can retrieve parent page data with the [[:docs:navigation:hierarchical_breadcrumb|hierarchical breadcrumb]].