Change Log

  • All new article

Contributors:

Adam Wilson - Logo Pogo

domain_settings

This module component retrieves settings associated with the current domain, or optionally from another specified domain configured in the site instance.

This component can be output throughout all site content areas and emails with the retrieved settings including things like the domain's default landing page, country, culture and currency attributes.

{% component type: "domain_settings" %}

Parameters and Options

Parameter
Values
Required
Description
type
domain_settings

This is the name of the entity that needs to be used for the component retrieving function.

domain
<YOURDOMAIN.COM>

Specify any additional saved domain for the site to access its domain settings.

Leaving out this parameter, or leaving the value empty, will result in the current domain used as default.

collectionVariable
<yourLiquidVariableName>

Assigns the data to a Liquid collection enabling further access to the data on the Page or Template using Liquid.

Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.

Liquid Output

The below example shows the domain settings available for the site. The Liquid data output from this example would look like the following (for example, when using a collectionVariable to create the collection):

{
  "Domain": "treepl-docs-v7.treepl.co",
  "Country": {
    "Name": "UNITED STATES",
    "Code": "US"
  },
  "LandingPage": {
    "Id": 1865,
    "Url": "/documentation",
    "Name": "Documentation"
  },
  "FormatSetting": {
    "Id": "2231",
    "Name": "USD",
    "Culture": "en-US",
    "DecimalsQuantity": 2,
    "Currency": {
      "Code": "USD",
      "Symbol": "$",
      "DigitalCode": "840",
      "Name": "US Dollar"
    }
  },
  "Params": {
    "type": "domain_settings",
    "collectionvariable": "domainCollection"
  }
}

The data exposed is explained further in the table below:

Name
Description
Domain
The domain name being referenced for the retrieved settings.
Country.Name
Standard name of the domain’s applied country.
Country.Code
Standard 2 letter code of the domain’s applied country.
LandingPage.Id
System ID of the domain’s applied landing page.
LandingPage.Url
URL of the domain’s applied landing page.
LandingPage.Name
Item name of the domain’s applied landing page.
FormatSetting.Id
System ID of the domain’s applied Culture & Currency settings.
FormatSetting.Name
Descriptive name (from the admin) of the domain’s applied Culture & Currency settings.
FormatSetting.Culture
Standard culture/country code of the domain’s applied culture.
FormatSetting.DecimalsQuantity
Number of digits to display for decimal numbers.
FormatSetting.Currency.Code
Standard currency code of the domain’s applied currency.
FormatSetting.Currency.Symbol
Standard currency symbol of the domain’s applied currency.
FormatSetting.Currency.DigitalCode
Standard currency digital code of the domain’s applied currency.
FormatSetting.Currency.Name
Standard descriptive name of the domain’s applied currency.

Accessing the Data

JSON Output

You can output the full JSON for your component data by referencing the root Liquid object {{this}} in your module’s layouts, or directly on your page, if using the collectionVariable parameter in your component tag.

For example:

{% component type: ... collectionVariable: "myData" %}

You can then render the JSON like so:

{{myData}}

For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.

Rendering Property Values

There is no default or virtual layout for this component. It is purely a data object for Liquid usage.

This data is accessible directly on the Page or Template via a Liquid Collection by adding collectionVariable to the Component.

An example using collectionVariable with value "domainCollection" for the current domain:

{% component type: "domain_settings", collectionVariable: "domainCollection" %}

Accessing a specific item within the collection. In this case the currency name, which in our example would render the value US Dollar

{{domainCollection.FormatSetting.Currency.Name}}