The **site metafields** feature allows you to add custom properties to your sites. Following the Locomotive philosophy, each site could have its own set of custom properties.

For instance, it's very useful if you want to store additional information about your site such as the full address or the opening hours of the restaurant site you're building for your client.

That could also be the right place to store the links to the Facebook page or to the twitter account.

**Note:** Metafields only work with Wagon versions, higher than 2.1.0

## Describe your metafields in Wagon

Site metafields are described in a YAML file at this location `config/metafields_schema.yml` inside your Wagon site.

Metafields are grouped inside **namespaces**. Then, each metafield has a name and several properties (label, hint, type, ...etc) defining the look&feel of the inputs in the back-office.

## Syntax



## Example



## Use metafields in Liquid

First, you can assign default values in your Wagon site by simply modifying your `config/site.yml` file. Here is an example based on the schema displayed above.



Accessing those values in any liquid template (page or snippet) is fairly easy.

## Syntax



## Examples



You can also loop over the metafields of a namespace.



## Boolean Values in Metafields

## Example

Consider the example of a metafield for store hours that is set according to whether or not Saturday hours are in effect. This field will be used to determine whether Saturday hours are displayed on the site.



We only want to display the Saturday hours if `saturday_effective` is true, so we wrap the Saturday hours in an if block.



## Editing metafields values in the back-office

Once your Wagon site has been deployed, you will see a new section named **Properties** in the left sidebar of your site back-office. In the example below we named the tab Website theme.

602


If you click on it, you will then see the UI generated from your YAML schema file.

1266