Versions Compared

Key

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

...

Info

Please make sure to name your Layout Block well. This is the name that the Marketing Department will see when they want to create or change a Narrative, so it needs to make sense for them. Please refrain from indicating any type of naming based on a project use-case, as the Layout Blocks should make sense for other projects.
For example, do not use a name like : “brand_logo”, for the Layout Block to be used inside a slider or a grid of brand logos. instead, use a name like “image_square” or “image_cell” or “image_with_link” which describes what the template does functionally, so it will make sense in many different use-cases.

...

Edit a Layout Block

Now your Layout Block should appear in the list. You can edit it by clicking on the little pencil icon on the right.

...

You can now edit the content of your Layout Block, which mainly consists in 2 parts:

1. Define the fixed parameters

As defined in Narrative API - Technical Reference , the following fixed parameters should be defined:

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

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.

In addition to the template, model (and optionally position), you can add other parameters if you want. They will be returned by the Narrative API, but will be fixed (so they will always be returned in the same way for the same Layout Block).

...

2. Define the JSON SCHEME