bag (...)

  • Template variable: bag

This handy function can look up data from Databags. The path to the values is a dotted path but alternatively multiple parameters can be provided that will me concatenated into a dotted path.

Simple Example

<title>{{ bag('site.title') }}</title>

alternative method that does the same:

<title>{{ bag('site', 'title') }}</title>

Example with Alternatives

Because you can use arbitrary variables in it, this is a simple way to load translations from a data bag:

<a href="#">{{ bag('i18n', alt, 'CLICK_HERE') }}</a>

Comments