Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Context variables

You can insert context variables in any template. These variables will be replaced by the actual values when accessing the generated page.

To insert a variable, write its name between {{ and }}. Example: {{ business.name }}

Table of contents
  1. canonical_tag and canonical_url
  2. business
  3. locations
  4. location
  5. areas
  6. area
  7. parent_areas
  8. sibling_areas
  9. locale
  10. locale_segment
  11. default_locale
  12. published_locales
  13. query_params
  14. theme_variables
  15. pages (shared variable inside variables)

canonical_tag and canonical_url

Available in all template types. Normally, used inside the head section of the HTML.

  • canonical_tag: A tag used when accessing the same page via multiple URLs, to indicate search engines that they are actually the same page.
  • canonical_url: Canonical URL.

business

Included in all template types. Contain properties of the current business

Insert them with {{ business.[attribute] }}

The variable has the following attributes:

Variable Description
id ID of the business.
localistico_id Localistico ID of the business.
name Name of the Business.
main_domain Main domain of the business.
logo.[version] URL of the specified version of the logo.
original: Original uploaded image.
thumb: exactly 100x100px distorting the image if necessary.
small: max. 512x512px keeping the original aspect ratio.
square: exactly 512x512px distorting the image if necessary.
landscape: exactly 1600x500px (16:9 proportion) distorting the image if necessary.
area_names_locale Locale of area names
exposed_custom_attributes_in_api An array with all the exposed location custom attributes.
hide_permanently_closed_locations Boolean with the status of how to hide permanently closed locations
custom_attribute_* Business custom attributes
pages An array with all the pages with the type locator. See shared variables in this page.

locations

Available in all templates. It contains a list of locations, but contents depends on the type of template:

  • Business (Locator) templates: a list with all locations of the business
  • Location (Store and Landing) templates: the same as above, but each location has two additional fields: distance and current_template_url
  • Area (Country, Region, City) templates: it contains the locations inside the current area.

Insert them with:

{% for loc in locations %}
  {{ loc.[attribute] }}
{% endfor %}

Each element of the array has the same attributes of the location variable below.

location

Available only in Location templates (Store and Landing). It includes information about the current location.

Insert them with {{ location.[attribute] }}

Variable Description
id Internal ID in Localistico
location_external_id ID used in Localisitco to identify this location
name Name of the location.
lat Latitude.
lng Longitude.
full_address Full address formatted according to the country. The format may span multiple lines. To show it as a one-liner you may use, for example: {{ location.full_address |replace: '<br />', ', ' }}.
street_address Address.
postcode Postal code
locality City/town.
region State or region.
country_code Standard code of the country.
phone Phone number.
national_phone_number Formatted phone number according to country rules (without international prefix).
international_phone_number Formatted phone number according to country rules (with international prefix).
website Website.
summary Full description.
short_summary Short description.
hours Structured object with the opening hours. Check how to display Opening Hours
special_hours Special hours represent the hours where this venue will be open or close or not outside regular schedule.
It needs to be a JSON array of objects, in which each object has:
start_date: when this special hours are effective
end_date: then this specials hours stop to be active
timeframes: Represented in seconds from the 00:00. So, 27000 is 07:30 (27000 / 3600). Those fields are used in pairs. E.g. [27000, 45000, 55000, 60000] => from 27000 to 45000 and from 55000 to 60000. If timeframes is empty, it means the venue is closed.
closed: This field will always be true if timeframes is empty, and false otherwise.
open_status Open status. Accepted values: open, temporarily_closed, permanently_closed
images An array with all the images for the location. Each image has the following attributes: role, alt, label and an attribute for each version with the URL to that image version.
original: Original uploaded image.
thumb: exactly 100x100px distorting the image if necessary.
small: max. 512x512px keeping the original aspect ratio.
square: exactly 512x512px distorting the image if necessary.
landscape: exactly 1600x500px (16:9 proportion) distorting the image if necessary.
areas Structured object with the areas for this location: country, city, administrative_area_level1 and administrative_area_level2.
localistico_tags An array with all localistico tags of this location.
links An array with structured object with all social profiles of this location.
url: URL of the social profile
owned: boolean to know if you are the owner
rating: rating of the social profile
platform: platform of the social profile
max_rating: max rating of the social profile
total_reviews: total reviews of the social profile
custom_attribute_* Location custom attributes
pages An array with all the pages of this location. See shared variables in this page.
distance This variable is added to each location when rendering a multi-page template. It indicates the distance from this location to the page location in meters.
current_template_url This variable is added to each location when rendering a multi-page template. It contains the full URL of the location’s page for the same template.

areas

Available in all templates. It contains a list of areas, but the contents depends on the type of template:

  • Business (Locator) templates: a list with all areas of the given business
  • Location (Store and Landing) templates: a list of all areas where the current location is included in
  • Area (Country, Region, City) templates: a list of the sub-areas of the current areas

Insert them with:

{% for area in areas %}
  {{ area.[attribute] }}
{% endfor %}

Each element of the array has the same attributes of the area variable below.

area

Available only in Area templates (Country, Region, City). It includes information about the current area.

Insert them with {{ area.[attribute] }}

Variable Description
display_name Display name of the area.
name Name of the area.
type Type (Country, Region, City).
slug Slug of the area.
code Only available in the country type.
pages An array with all the pages of this location. See shared variables in this page.

parent_areas

Available only in Area templates (Country, Region, City). It includes information about the parent areas.

Each element of the array has the same attributes of the area variable above.

sibling_areas

Available only in Area templates (Country, Region, City). It includes information about the sibling areas.

Each element of the array has the same attributes of the area variable above.

locale

Available in all template types. Include the locale code of the current localised page.

Insert them with {{ locale }}

locale_segment

Available in all template types. Include the current segment (path) of the localised page.

Insert them with {{ locale_segment }}

default_locale

Available in all template types. It includes information about the default locale.

Insert them with {{ default_locale.[attribute] }}

Variable Description
code Standard code of the locale.
url Full URL of the localised page.

published_locales

Available in all template types. It includes information about the published locales.

Each element of the array has the same attributes of the default_locale variable above.

query_params

Available in all template types. It includes an object with all the query params in the current page.

Insert them with {{ query_params.[attribute] }} to return the value.

theme_variables

Available in all template types. It includes all the variables in the current theme.

Insert them with {{ theme_variables.[attribute] }}

pages (shared variable inside variables)

Each element of the array has these attributes.

Variable Description
url Full URL of the location’s page.
template_name Name of the page.
template_id ID of the page.
template_key Key of the page.

Inserts the URL of the given template and model by searching the page in the pages variable inside the model with find_page_url

Insert them with {% find_page_url template_key location %}