Skip to content

Latest commit

 

History

History
58 lines (43 loc) · 975 Bytes

maps.markdown

File metadata and controls

58 lines (43 loc) · 975 Bytes
layout title permalink nav_order
page
Maps
/maps/
4

{% include ace.html %}

Maps

Maps are simple key/value pair structures, they translate to JSON Objects.

Example

introduction = {
  "greeting": "hello",
  "subject": "world"
}

Difference between Blocks and Maps

When translated to JSON, both Blocks and Maps become plain objects, they however differ in the following ways:

Blocks

  • designed as a structural construct
  • support @directives at their root
  • cannot be piped
  • tolerant syntax (commas are optional)
Example
block {
  @directive

  key   = "value"
  key2  = "value2"
}

Maps

  • designed as a value
  • strict syntax (mandatory commas, keys are strings)
  • do not support @directives at their root
  • can be piped
Example
map = {
  "key": "value",
  "key2": "value2"
}