24min

Blog

Add posts in the Admin and display on the Site with List and Detail Views, search and filter List Views and combine with the Authors Module.

Dependencies

Authors Module - optional

Syntax

HTML
|

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
    • properties.release_date - date the item is set to be released
  • 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

Liquid Tag

Description

Item Name

{{ this['name'] }}

name of the Blog Post

Item Slug

{{ this['slug'] }} 

item URL

Weighting

{{ this['weighting'] }} 

weight of item, used for sorting

Release Date

{{ this['release_date'] }} 

release date of the item

Expiry Date

{{ this['expiry_date'] }} 

expiry date of the item

Enabled

{{ this['enabled'] }} 

enable/disable the item

Title

{{ this['Title'] }}

title of the Blog Post

Subtitle

{{ this['Subtitle'] }}

subtitle of the Blog Post

Description

{{ this['Description'] }}

list description of the Blog Post

Author - Syntax type 1 (Requires Authors Module)

{%- include 'modules/siteglide_authors/get/get_item_author', author_layout: 'design_system/1/author', author_layout_type: 'list', author_id: this['Author'] -%}

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'].

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

{% include 'module', id: '6', item_ids: this['Author'], layout: 'design_system/1/author', type: "list", datasource: 'true' -%}

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']

Main Image

{{ this['Main Image'] }}

main image of the Blog Post

Main Image Alt

{{ this['Main Image Alt'] }}

main image alt tag of the Blog Post

List Image

{{ this['List Image'] }}

list image of the Blog Post

List Image Alt

{{ this['List Image Alt'] }}

list image alt tag of the Blog Post

Content

{{ this['Content'] }}

main content of the Blog Post

Category Array

{{ this.category_array }}

outputs comma-separated list of IDs for Categories this item belongs to. 

How to output a List of Categories that your Blog Module Belongs to

You can learn more about how to use the {{this.category_array}} field to output a List of Categories that belong to the Blog Item ( or, in fact, any Module or WebApp item) here: Outputting Categories on WebApp / Module / eCommerce Layouts

Filtering the Blog List View by Category, Author or Date

You can learn more about the multiple ways of navigating and filtering the Blog List view here: Blog Navigation Introduction

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

Further folders exist for storing Layouts for components like sidebars and filters.

Updated 06 Sep 2021
Did this page help?
Yes
No