liquid

Connect Content with Channels in Modyo

One of the great features that we have in Modyo is our independent content management system in Content. We're going to demonstrate how the Liquid SDK works to be able to connect Content with Channels, our web application and content manager solution.

The first thing we have to do is have a Space and a Type with content already loaded and with a liquid assign we are going to call them from a page.

In the following example, entries is assigned all entries from space 'space_uid' with type 'type_uid'.

{% assign entries = spaces['space_uid'].types['type_uid'].entries %}

Next, we display the entries using a for, printing the 'meta.uuid' and 'meta.title' from each entry.

{% for entry in entries %}
  entry: {{ entry.meta.uuid }} - Connect Content with Channels in Modyo 
{% endfor %}

Now we can generate the HTML using Liquid Drops. Using output statements we will print the meta.title and fields.name.

{{ entry.meta.title }}
{{ entry.fields.name }} 
Filters

The assign created previously will return a loop of all entries, if we want to filter them further, we can use Liquid filters in the same assignment:

{% assign entries = spaces['space_uid'].types['type_uid'].entries | by_category: 'news' | by_tag: 'devs' | sort_by: 'fields.date' , 'desc' | limit 8%}

In this example we filter by the category 'news' with tag 'devs', then we sort them by 'fields.date' with a limit of 8 entries.

To see more examples of what you can do with Liquid SDK in Modyo, see Public API Reference in Modyo Docs.

Photo by Kelly Sikkema on Unsplash.

By

Felipe Meyer

Felipe Meyer