Dependencies

Authors Module - optional

Syntax

{%- include 'module', id: '3', layout: 'default', per_page: 20, sort_type: 'properties.name', sort_order: 'asc' -%}

Parameters

id - the Module's ID
item_ids - output one or more module items, comma seperated
category_ids - output all items in one or more categories, comma seperated
layout - default is /default/ - 'layout' values are relative to the folder: layouts/modules/Blog (module_3)/[layout name]
per_page - defines the number of items outputted on the page
show_pagination - default is true - defines if items should be paginated when the per_page is met.
sort_type - defines the type by which items are ordered
    properties.name - name of the Module item (alphabetical)
    created_at - date the Module item was created
    updated_at - date the Module item was last edited
    properties.weighting - weighting of the Module item
sort_order - defines the order in which the type is sorted
    asc - sort items in ascending order
    desc - sort items in descending order
collection - default is 'false' - If you set it as collection: 'true' then any layout is suppressed.Data is accessible via {{context.exports.webapp_1.data}}. For Example, name would be: {{context.exports.webapp_1.data.result.items[0]['name']}}

Liquid Tags



Field Name: Item Name
Liquid Tag: {{ this['name'] }}
Description: name of the Blog Post

Field Name: Item Slug
Liquid Tag: {{ this['slug'] }}
Description: item URL

Field Name: Weighting
Liquid Tag: {{ this['weighting'] }}
Description: weight of item, used for sorting

Field Name: Release Date
Liquid Tag: {{ this['release_date'] }}
Description: release date of the item

Field Name: Expiry Date
Liquid Tag: {{ this['expiry_date'] }}
Description: expiry date of the item

Field Name: Enabled
Liquid Tag: {{ this['enabled'] }}
Description: enable/disable the item

Field Name: Title
Liquid Tag: {{ this['title'] }}
Description: title of the Blog Post

Field Name: Subtitle
Liquid Tag: {{ this['subtitle'] }}
Description: subtitle of the Blog Post

Field Name: Description
Liquid Tag: {{ this['description'] }}
Description: list description of the Blog Post

Field Name: Author - Syntax type 1 (Requires Authors Module)
Liquid Tag: {%- include 'modules/siteglide_authors/get/get_item_author', author_layout: 'design_system/1/author', author_layout_type: 'list', author_id: this['Author'] -%}
Description: data source of author. Parameters: author_layout: path to the folder containing author layouts. author_layout_type: name of author layout folder (containing wrapper and item files). author_id: Unique ID of the author for this item- can be dynamically passed in with this['Author'].

Field Name: Author - Syntax type 2 (Requires Authors Module) The benefit of this syntax is that it should be more consistent with how other Modules are outputted on the Page.
Liquid Tag: {% include 'module', id: '6', item_ids: this['Author'], layout: 'design_system/1/author', type: "list", datasource: 'true' -%}
Description: data source of author. Parameters: layout path to the folder containing author layouts within the blog module. type- name of the layout folder containing wrapper and item Liquid layout files. datasource - should be set to true to indicate that this module is a sub-module placed inside another module Layout. item_ids - indicates the unique ids of the Author items you want to display- can be dynamically passed in with this['Author'].

Field Name: Main Image
Liquid Tag: {{ this['main_image'] }}
Description: Main image of the Blog Post

Field Name: Main Image Alt
Liquid Tag: {{ this['main_image_alt'] }}
Description: Main image alt tag of the Blog Post

Field Name: List Image
Liquid Tag: {{ this['list_image'] }}
Description: List image of the Blog Post

Field Name: List Image Alt
Liquid Tag: {{ this['list_image_alt'] }}
Description: List image alt tag of the Blog Post

Field Name: Content
Liquid Tag: {{ this['content'] }}
Description: Main content of the Blog Post

Field Name: Category Array
Liquid Tag: {{ this.category_array }}
Description: Outputs comma-separated list of IDs for Categories this item belongs to. 

How to Output Categories


What if you want to output a List of Categories that the Blog Item belongs to?

Method 1) Using Pre-fetched Category Data

The most efficient method is to use the category_array field to fetch the Category IDs and then to use the pre-fetched Categories in exports to look up the details. This method does not use a Layout, though it will lead to a faster Page Load.

  1. Firstly, loop over Category IDs:
{% for category in this.category_array %}

{% endfor %}

   2. Secondly, fetch the Details of the Categories from Exports. As the categories are stored in Exports as a map, we can use a Category ID in square brackets to "look up" a specific Category's fields.

{% for category in this.category_array %}
  {% assign this_category = context.exports.categories.data[category] %}

{% endfor %}

3. Add a link to your Blog List View + a Category query parameter in the URL to filter the List on arrival. We'll use the dynamic variable "category" which holds the ID for this category.

{% for category in this.category_array %}
  {% assign this_category = context.exports.categories.data[category] %}
  <a href="/blog?category={{category}}"></a>
{% endfor %}

4. Add the category name. We've used the "this_category" variable to store the pre-fetched category data, so you can access category fields there using dot-notation.

{% for category in this.category_array %}
  {% assign this_category = context.exports.categories.data[category] %}
  <a href="/blog?category={{category}}">{{this_category.name}}</a>
{% endfor %}

5. Add any wrapper elements you like around the loop.

<p class="tag"><i class="fas fa-tag"></i>
  {% for category in this.category_array %}
    {% assign this_category = context.exports.categories.data[category] %}
    <a href="/blog?category={{category}}">{{this_category.name}}</a>
  {% endfor %}
</p>


Method 2: Using a Category Layout

This method may be easier, as you need less Liquid code to implement it, however, it comes with a slower Page Load time- as it has to fetch the Category Data multiple times. The Layouts will exist within a sub-folder of the Blog Layout you're using.

{%- include 'modules/siteglide_system/get/get_item_categories', categories_layout: 'default/categories', categories_layout_type: 'detail' -%}

Layout Files

Blog Module layouts are stored in the following folder structure, which you can view via Code Editor: layouts/modules/Blog (module_3)/

Within this module folder you will find the following layout folders:

default/ - the default layout folder
    detail/ - full page layouts folder (default not in use)
        item.liquid - detail item content file
        wrapper.liquid - detail item wrapper file
    list/ - page section layouts folder
        item.liquid - list item content file
        wrapper.liquid - list item wrapper file

Did this answer your question?