Custom tags

In addition to the tags available by the standard implementation of the Liquid syntax, we provide a few more.

Table of contents
  1. asset_path [asset_name]
    1. Example
  2. asset_content [asset_name]
    1. Example
  3. content_for_head
    1. Example
  4. find_page_url [template_key] [model]
    1. Example
  5. snippet [key] [params]
    1. Example
  6. business_json_ld [params]
    1. Examples
  7. location_json [params]
    1. Example
  8. location_json_ld [location_id] [params]
    1. Example

These tags will be executed when rendering the template, and the resulting value will be inserted.

To call a tag, insert its name and parameters between {% and %}.

Example: {% asset_path application.js %}.

NOTE: Don’t use quotes to surround parameters.

asset_path [asset_name]

Inserts a URL to the specified asset.

Example
{% asset_path application.css %}

asset_content [asset_name]

Inserts the contents of the specified asset.

Example
{% asset_content application.css %}

content_for_head

Inserts a hreflang tags the theme’s default locale and the published ones.

Example
{% content_for_head %}

find_page_url [template_key] [model]

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

Example
{% for location in locations %}
  {% find_page_url my-awesome-template location %}
{% endfor %}

snippet [key] [params]

Allows to include a snippet in the template, referenced by the key.

Parameters can be passed to the snippet in the form of a list of [parameter]=[value]. Values can be either strings surrounded by double or single quotes or variables that are available in the template.

Example
{% snippet opening-hours title="Opening hours" hours=location.hours country_code=location.country_code %}

business_json_ld [params]

Renders the Busines JSON LD and it’s nested Location JSON LD. Available params can be passed to overwrite defaults. All parameters are optional.

Available parameters:

  • name: Overrides the business name.
  • type: Overrides the business type.
  • location_type: Overrides the type used for locations.
  • location_template_key: Overrides the template used to generate location urls.
Examples
{% business_json_ld %}
{% business_json_ld name='Test Name' type='ExampleType' location_type='ExampleLocationType' location_template_key='my-awesome-template' %}

location_json [params]

Renders the location JSON with the location data.

Available parameters:

  • location: To render the Current Page location.
Example
{% location_json location %}

location_json_ld [location_id] [params]

Renders the Location JSON LD for the provided location_id. The rest of accepted params can be passed to overwrite defaults. All parameters are optional except the location_id.

For location templates (Landing/Store) it is possible to use the location variable instead of providing it’s uuid.

Available parameters:

  • name: Overrides the location name.
  • type: Overrides the location type.
  • description: Overrides the location description.
  • template_key: Overrides the template used to generate the url for the location.
  • review_platform: Used to include a specific platform review. Examples: google, facebook, tripadvisor.
Example

{% location_json_ld location.id %}


{% location_json_ld location.id name='Example Name' type='ExampleType' template_key='my-awesome-template' review_platform='google' %}