# Block

A block represents the content and settings of a single block in a list of section blocks.

A `block` represents the content and settings of a single block in a list of [section blocks](https://developer.versacommerce.de/articles/liquid-objects-section#section-blocks). In a section file you access the `block` object by looping over `section.blocks`.

```liquid
{% for block in section.blocks %}

 <!-- output block content -->
{% endfor %}
```

The `block` object has the following attributes:

## block.id

Returns a unique ID generated dynamically by VersaCommerce.

## block.settings

Returns an object with the [block settings](https://developer.versacommerce.de/articles/liquid-objects-section#section-settings) set in the theme editor. Access setting values by the unique setting `id`.

```liquid
<img src="{{ block.settings.image | image_url: width: 800 }}" alt="{{ block.settings.image.alt }}">
```

```html
<img src="//cdn.versacommerce.de/.../promo-banner1.jpg&width=800" alt="New season - Spring 2017">
```

## block.shopify_attributes

Returns a string with the attributes of the block.

The theme editor's JavaScript API uses a block's `shopify_attributes` to identify blocks and listen for events. In the theme editor, VersaCommerce outputs the `data-shopify-editor-block` attribute here (with the block's `id` and `type` as JSON). Outside the theme editor, `block.shopify_attributes` is an empty string.

## block.type

Returns the type defined in the [block's schema](https://developer.versacommerce.de/articles/liquid-objects-section#section-blocks). This is useful to show different markup depending on `block.type`.

```liquid
{% for block in section.blocks %}
  {% if block.type == 'advert' %}
    <!-- output an image with a link -->
  {% elsif block.type == 'headline' %}
    <!-- output a header with text -->
  {% endif %}
{% endfor %}
```


## More properties

VersaCommerce also provides these properties on the `block` object:

| Properties | Returns |
|---|---|
| `blocks`, `static?` | Nested active children and static-block status |
