Learn how to use custom data collections to manage dynamic segments and pages like menus, blogs, news, jobs and more.

Data Collections allow you to define your own models with various attributes to use within your custom elements.

How to create a Data Collection

To create a Data Collection, simply log into your Shogun dashboard and navigate to 'Data Collections' in the menu.

How to add properties to a Data Collection

Properties can be added to your Data Collections to allow you to store data in them. The property can be one of the following types:

  • Plain Text
  • Rich Text
  • Image (HTML)
  • Image (URL)
  • Markdown
  • HTML
  • Integer
  • Boolean / checkbox

You may add multiple properties to a Data Collection depending on your needs.

How to add an entry to your Data Collection

Adding an entry to your data collection is super easy. Simply select 'Add Entry' and you will be able to add an entry using the properties that you defined.

How to use a Data Collection in a Custom Element

You can create a Custom Element on your page to display the content of your new Data Collection. To get started navigate to the 'Custom Elements' of the dashboard.

To use the new Data Collection:

  1. Create a variable to add your collection to.
  2. Select 'Collection' in the right-hand menu of the editor
  3. Select your collection from the dropdown menu
  4. Hit save

You will see the properties of the Data Collection in the right-hand menu of the editor.

How to use your Custom Element and Data Collection on a page

Just like any other Custom Element, you will find your new element in the 'Custom Elements' section of your editor.

To use this on your page, you can simply drag this onto your page like any other element!

What are the benefits of Data Collections?

When you need to update a Data Collection, all of the pages with this Data Collection will be updated automatically. This allows for you to create sections that can be updated.

What is the best way of using the data in a Custom Element?

Once a Data Collection is set into a Custom Element, you can go ahead and get started with reading in this data by referencing their properties. You will need to follow the instructions above in order to ensure that your Data Collection is assigned to a variable before you get started.

Referencing a property is super easy to do, this can be done using the property name, for example,

{{ my_data_collection.my_property }}

If you are working with lists of data, it is best to use a for loop to access all of your data in the Data Collection.

{{ for data in my_data_collection }}
    {{ data.my_property }}
{{ endfor }}

This will ensure that all of your content is looped through and displayed as you would like it to be.

Did this answer your question?