Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Name

Example Value

Description

template

product_list

the name of the template which should be used to display the block and its parameters

model

product_list

(optional) the model that should be use in your MVC to manage the logic for this template rendering.

In the majority of the cases you should not require any business logic and render the template directly, but in special situation (e.g.: to do a real-time look-up of a price before display) some controller method might be required in your template

position

main

(optional) if you use a multiple column layout (e.g.: with search facets on the left column and results on the main column) this parameter will indicate for which column of your layout this block is destined.

important: this parameter will change the structure of the response, see Fixed base structure above for details in Narrative API - Technical Reference

Info

As Best Practice, we recommend you to set template and model with the same value and to name them exactly as you named your Layout Block, this will make things easier and consistent.

Also, you might see some parameters appear by default like “content-resource” and can ignore them.

...

Info

For every parameter which is localized (meaning it could be different in each language), the structure of the example must be followed, so your property must be of the type “object” and have sub-properties with, as keys, the possible language codes (e.g.: “en”, “de”, “fr”, “it”, …). The value of each language must be of the type “string”.

In the response from the Narrative API, you will not receive the same structure, but only one string value for that property with the value in the requested language (i.e.: in this example, “banner_redirect” will be set with String as value with the value in the requested language).

Code Block
{
  "title": "Banner",
  "type": "object",
  "properties": {
    "banner_redirect": {
      "type": "object",
      "title": "Banner Redirect URL",
      "properties": {
        "de": {
          "type": "string",
          "description": "Set Banner Redirect URL in German."
        },
        "fr": {
          "type": "string",
          "description": "Set Banner Redirect URL in French."
        }
      }
    },
    "banner_src": {
      "type": "object",
      "title": "Banner Source",
      "properties": {
        "de": {
          "type": "string",
          "description": "Set Banner Source in German."
        },
        "fr": {
          "type": "string",
          "description": "Set Banner Source in French."
        }
      }
    },
    "banner_alt": {
      "type": "object",
      "title": "Banner Alternative Text",
      "properties": {
        "de": {
          "type": "string",
          "description": "Set Banner Alternative Text in German."
        },
        "fr": {
          "type": "string",
          "description": "Set Banner Alternative Text in French."
        }
      }
    }
  }
}

3. Define the dynamic parameters & add their accessors to the JSON SCHEME