Change log

module (Blog Post)

This module component fetches data relating to Blog Posts.

{% component type: "module", source: "Blog Post", layout: "List" %}

Parameters and Options

Parameter
Values
Required
Description
type
module (default)
module_of_member

This is the name of the entity that needs to be used for the component retrieving function.

module is the standard retrieving function to retrieve all items.

module_of_member retrieves only those items 'Added by' the currently logged in user (identified by the CreatedByMemberId property in the module items Liquid data).

The 'Added by' System Property will only be available where the modules settings have 'Allow Add New Items' turned on under the 'Site User Permissions'.

source
Blog Post (default)
The module’s entity/alias name or ID that the data is to be sourced from.
layout
List (default)
<Your Layout name>

The layout name you want to use for rendering the component. The layout name is referenced from the available Layouts of the source specified.

While this parameter is required to render your Layout markup, if the parameter is blank, has an incorrectly referenced Layout, or is removed altogether then the component will still output the modules item data to a Liquid collection which can be accessed via the collectionVariable parameter.

filterBy
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module

The name of the property to filter by. If empty or not present, no filtering will be used.

Remove spaces from custom property names here.

filterValue
<your value>

Your specific value to filter by, eg: name, id, number, date, etc.
Liquid variables can be used here also. If present but no value set, no items will be returned.
sortBy
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module

The name of the property to sort by. If empty or not present, alpha/numeric sorting will be used.

Remove spaces from custom property names here.

sortOrder
ASC (default)
DESC

ASC sorts the items in ascending order while DESC sorts in descending order (based on alpha/numeric or date sorting).
If empty or not present, alpha/numeric sorting will be used.
ignoreWeighting
false (default)
true

Enables/disables sorting items first by their weighting values. When false items will sort by their weighting values first, followed by any sortBy properties (or the default alpha/numeric sorting if sortBy is empty or not present). If true item weightings will be ignored and sorting will only be applied via sortBy or default sorting.
random
false (default)
true

Displays the available items in a random order.

If used in conjunction with sortBy, that sorting criteria will be applied to the randomly retrieved results. So, if retrieving all, or most, of the items they will not appear to be random since they will then be sorted back into a logical order. To overcome this, set the sortBy parameter to 'enabled' (or another unused property) as this will not provide any viable sorting criteria* and the items will not be sorted from their initial random order.
* Unless there are weighted items, which will always override the random option.

If this param's value is 'true' - pagination will not be shown.
limit
10 (default)
<integer>

The maximum number of items returned. If displayPagination is enabled this determines the maximum number of items per page.
enablePagination
true (default)
false

Enables/disables pagination for the component.

This is useful for avoiding pagniation affects for a specific component when multiple components of the same module are output on the same page and do use pagination.

displayPagination
false (default)
true

Displays pagination if there are more items available than the limit set.
emptyMessage
<Your custom message>

Custom content that is rendered if no items are returned by the Component. The default is no content.
Liquid variables are supported here, although Liquid logic tags and HTML are not.

If using Liquid variables with filters added, be sure to change any double quotes to single quotes. For eg:
emptyMessage: “{{ myVariable | prepend: 'Error: ' }}”

To use HTML in your empty message, first capture it using a Liquid capture, then insert the capture variable into the emptyMessage parameter.

object
item (default)
collection

Determines the method for Liquid rendering.
item returns each item iteratively, one after another, for output (generally, output to a container element with no need for looping through the data).
collection returns all items as one collection for output (your container element and looping logic would be handled in the Components Layout).
collectionVariable
<yourLiquidVariableName>

Assigns the data to a Liquid collection enabling further access to the data on the Page or Template using Liquid.

Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.

isSearchResult
false (default)
true

Allows search parameters in the URL to override the components output. Therefore, this parameter can be used to output module specific search results from a submitted search form.

Likewise, Tag, Category, and Archive components can be used in conjunction with this parameter for filtering the module's output.

URL search parameters will override any corresponding parameters in the component. If no search parameters are present in the URL, isSearchResult will be ignored.

Any value other than true, (including an empty value), will disable the search functionality and the component will output its regular data.

searchScope
eg:
{'prop_ParentId':'1234', 'prop_ReleaseDate_Min':'2018-07-01', 'prop_ReleaseDate_Max':'2018-07-31', 'prop_KeyWords':'Your Keywords', 'prop_ItemTags':['tag1','tag2'], 'page':'2'}

Allows a search on the module without search parameters needed in the URL. Instead, search parameters are added to the value of this parameter. Therefore, this parameter can be used to output module specific search results from hard-coded (or Liquid) values without the use of a search form.

Added search parameters will override any corresponding parameters otherwise configured on the component. If no search parameters are present, searchScope will be ignored.

This value supports Liquid and can therefore be constructed with Liquid data/variables.

<customParameter>
<your custom value>

You can add your own additional parameters (name/value pairs) to the Component tag. These will be passed to the Components Layout (and the collectionVariable if used) for use via Liquid.

Your <customParameter> name must only contain English letters, numbers or underscores. Spaces or special characters are not supported.

You can use HTML as the value here, just be sure to change any double quotes in your HTML to single quotes.

Also, see here for a tutorial on using Custom Paramters.

Liquid Output

The below example has 3 sample items but is otherwise the default structure you will get from this Component.

{
  "Params": {
    "source": "Blog Post",
    "layout": "",
    "type": "module",
    "limit": "3",
    "collectionvariable": "allPosts"
  },
  "Pagination": {
    "CurrentPage": 1,
    "ItemsPerPage": 3,
    "NumberOfPages": 3,
    "TotalItemsCount": 7
  },
  "Parent": {
    "Id": 2142,
    "Name": "module (Blog Post)",
    "Url": "/component-types/module-blog-post",
    "Url_List": [
      "/component-types/module-blog-post"
    ],
    "UrlSlug": "module-blog-post",
    "ParentId": 2127,
    "ParentId_List": [
      2127
    ],
    "ParentName": "Liquid Components",
    "ParentUrl": "/component-types",
    "TemplateName": "Docs Template",
    "Module_Alias": "DocumentationPost",
    "Module_ID": 1870,
    "Enabled": true,
    "ReleaseDate": "2018-09-04T23:00:00",
    "ExpiryDate": "2099-12-09T00:00:00",
    "SiteSearchKeywords": [],
    "Description": "<p>This module component fetches data relating to Blog Posts.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n\r\n{% component type: \"snippet\", alias: \"section_parameters\" %}\r\n\r\n{% component type: \"json\", source_type:\"string\", source:\"{{tabularData}}\", layout:\"/snippets/tabularJSON.layout\" %}\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_output\" %}\r\n{% component source: \"Blog Post\", layout: "", type: \"module\", limit: \"3\", collectionVariable: \"allPosts\" %}\r\n<p>The below example has 3 sample <code>items</code> but is otherwise the default structure you will get from this Component.</p>\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{allPosts}}\", lang: \"json\" %}\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_accessing_data\" %}\r\n\r\n<p>This data is accessible in two main ways:</p>\r\n\r\n<p>1. Using Liquid in the specified Layout via the <code>this</code> object.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p>2. Directly on the Page or Template via a Liquid Collection if <code>collectionVariable</code> was added to the Component tag.</p>\r\n\r\n<p>An example using <code>collectionVariable</code> with value \"allPosts\" to list all \"Blog Posts\" across the site:</p>\r\n<p class=\"notice-note\">Here we suppress any Layout from rendering by setting <code>layout: \"\"</code> as an empty attribute.</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Looping through the collection to render all the item URLs in a list, giving us:</em></p>\r\n\r\n<ul>\r\n    \r\n        <li>/demo-html-blog/demo-html-post</li>\r\n    \r\n        <li>/demo-custom-blog-2/sample2-post-one</li>\r\n    \r\n        <li>/demo-custom-blog-2/sample2-post-three</li>\r\n    \r\n</ul>\r\n<br>\r\n<p><em>The code:</em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p><em>Accessing a specific item within the collection. In this case the third item (zero based index), which in our example would render the value <code>/demo-custom-blog-2/sample2-post-three</code></em></p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n</section>\r\n\r\n<section id=\"secListFilteredPosts\">\r\n    <h3>List Posts from a specific Blog</h3>\r\n<p>If you have more than one Blog on your site the above examples will list Posts from all Blogs as one single collection. However, typically you'd want to list all Posts from only the Blog they belong to (their \"parent\" Blog).</p>\r\n<p>To do this we add the <code>filterBy</code> and <code>filterValue</code> attributes to the Component tag.</p>\r\n<p>Typically, you would be listing Blog specific Posts on your Blog detail page/index page. In which case you would be editing the 'General Blog Layout' to insert your Component tag, which would look like this:</p>\r\n\r\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\r\n\r\n<p>As we are within the Blog's detail Layout (which represents the 'parent' Blog) we can reference its ID for the filter value using <code>{{this['id']}}</code> and instruct the Component tag to filter the Posts only by their parent (<code>filterBy: \"parentID\"</code>) - giving us only the relevant Posts for the current Blog.</p>\r\n<p>You may however, want to render a list of Posts on a standard page or within another modules layout,  where the Post's parent ID (the Blog it belongs to) is not readily available to us in the Liquid scope. In this case you would need to manually hardcode the desired parent Blog's ID into the component tag in place of the above Liquid generated ID (<code>filterValue: \"1234\"</code>).</p>\r\n<p class=\"notice-tip\">To obtain the Blog's ID from the admin, go to that Blog's list view (where you can see all of the Posts) and note the number in the URL address bar shown after the <code>parentID=</code> parameter.</p>\r\n</section>\r\n</section>\r\n\r\n{% component type: \"snippet\", alias: \"section_counter\" %}\r\n</section>\r\n",
    "Weighting": 969,
    "DisableForSiteSearch": false,
    "CreatedByMemberId": "0",
    "ItemCategories": [],
    "ItemCategoryIdList": [],
    "ItemTags": [
      "Blogs"
    ],
    "Author": 0,
    "Author_Name": "",
    "Author_Url": "",
    "Item_Rating": 0,
    "Active": true,
    "IgnoreUpdates": true,
    "UpdatesLog": "<ul>\n    <li>27-Oct-2020 | 5.6.0 | Added 'ignoreWeighting' parameter</li>\n    <li>'module_of_member' parameter details added.</li>\n</ul>",
    "ExternalResources": "<ul><li><a href=\"/demo-cs/all-posts\">Demo Site All Posts</a></li><li><a href=\"/demo-html-blog\">Demo Site Blog</a></li></ul>",
    "AdditionalRelatedArticle": 0,
    "AdditionalRelatedArticle2": 0,
    "Authors": "2418",
    "ShowPageForSearchEngine": true,
    "MetaTitle": "",
    "SEOTitle": "",
    "MetaDescription": "",
    "CanonicalLink": "",
    "SocialMetaTags": "",
    "SeoPriority": 0.8,
    "EnableAMP": false,
    "AMPContent": "",
    "OpenGraphProperties": {
      "title": null,
      "type": null,
      "url": null,
      "locale": null,
      "image": null
    },
    "ExternalId": 0,
    "Params": {
      "type": "snippet",
      "alias": "section_output",
      "data": "\r\n{% component type: \"module\", source: \"Blog Post\", layout: \"List\" %}\r\n",
      "lang": "liquid",
      "name": "SECTION Output",
      "content": "<section id=\"secOutput\">\n    <h2>Liquid Output</h2>",
      "enabled": true,
      "required": "true",
      "values": "List <em>(default)</em><br>&lt;Your Layout name&gt;"
    }
  },
  "Items": [
    {
      "Id": 2280,
      "Name": "DEMO HTML Post",
      "Url": "/demo-html-blog/demo-html-post",
      "Url_List": [
        "/demo-html-blog/demo-html-post"
      ],
      "UrlSlug": "demo-html-post",
      "ParentId": 2279,
      "ParentId_List": [
        2279
      ],
      "ParentName": "DEMO HTML Blog",
      "ParentUrl": "/demo-html-blog",
      "TemplateName": "DEMO Companion Site",
      "Module_Alias": "BlogPost",
      "Module_ID": 1534,
      "Enabled": true,
      "ReleaseDate": "2018-11-25T16:55:00",
      "ExpiryDate": "2099-12-10T16:55:00",
      "SiteSearchKeywords": [],
      "Description": "<p>Orci phasellus egestas tellus rutrum tellus pellentesque. Sed enim ut sem viverra aliquet. Sed euismod nisi porta lorem mollis aliquam ut porttitor. Eget duis at tellus at urna condimentum mattis pellentesque. A condimentum vitae sapien pellentesque habitant morbi tristique senectus et. Viverra aliquet eget sit amet tellus cras adipiscing enim.</p><p><span class=\"fr-emoticon fr-deletable fr-emoticon-img\" style=\"background: url(https://cdnjs.cloudflare.com/ajax/libs/emojione/2.0.1/assets/svg/1f60e.svg);\">&nbsp;</span>&nbsp;</p>\r\n",
      "Weighting": 0,
      "DisableForSiteSearch": false,
      "CreatedByMemberId": "0",
      "ItemCategories": [
        "Group 1/G1 Sub Cat I/G1 Sub Sub Cat I"
      ],
      "ItemCategoryIdList": [
        1353
      ],
      "ItemTags": [],
      "Author": 2274,
      "Author_Name": "DEMO Author One",
      "Author_Url": "/demo-author-one",
      "Item_Rating": 90,
      "Image": "",
      "ShowPageForSearchEngine": true,
      "MetaTitle": "",
      "SEOTitle": "",
      "MetaDescription": "",
      "CanonicalLink": "",
      "SocialMetaTags": "",
      "SeoPriority": 0.5,
      "EnableAMP": false,
      "AMPContent": "",
      "OpenGraphProperties": {
        "title": null,
        "type": null,
        "url": null,
        "locale": null,
        "image": null
      },
      "ExternalId": 0,
      "Params": {}
    },
    {
      "Id": 2468,
      "Name": "Sample2 Post One ",
      "Url": "/demo-custom-blog-2/sample2-post-one",
      "Url_List": [
        "/demo-custom-blog-2/sample2-post-one"
      ],
      "UrlSlug": "sample2-post-one",
      "ParentId": 2464,
      "ParentId_List": [
        2464
      ],
      "ParentName": "DEMO Custom Blog 2",
      "ParentUrl": "/demo-custom-blog-2",
      "TemplateName": "DEMO Companion Site",
      "Module_Alias": "BlogPost",
      "Module_ID": 1534,
      "Enabled": true,
      "ReleaseDate": "2019-10-06T20:00:00",
      "ExpiryDate": "2099-12-12T00:00:00",
      "SiteSearchKeywords": [],
      "Description": "<p>Cras elementum viverra nisl, at convallis urna tristique eu. Nam ut erat libero. In posuere turpis congue nunc rhoncus laoreet. In volutpat mauris vitae augue bibendum pharetra. Nullam pharetra, ligula ac ultricies porta, erat justo rhoncus nisl, sit amet tempus diam leo vitae turpis. Nam id lorem fringilla, finibus nulla efficitur, gravida lacus. Curabitur in molestie arcu. Sed eget tempor enim, vitae sagittis nisi. Sed porttitor euismod ex, accumsan lobortis quam lacinia quis. Aliquam dignissim vestibulum neque, ornare tristique elit sodales non. Interdum et malesuada fames ac ante ipsum primis in faucibus.</p><p>Aliquam id mattis elit, eu dictum sem. Suspendisse velit diam, pellentesque in commodo nec, tristique vel quam. Donec dapibus gravida volutpat. Nunc tellus metus, laoreet vel odio ut, fringilla posuere velit. Aliquam ut dignissim tellus, et condimentum eros. In aliquam leo nibh, sed facilisis nunc condimentum vitae. Duis vestibulum pellentesque orci, quis volutpat tellus commodo eget. Morbi congue hendrerit euismod. Maecenas vel porttitor sapien. Nam a leo vitae lectus rutrum feugiat. Sed mollis hendrerit odio, in porttitor metus cursus at. Sed vel tellus venenatis, maximus diam in, volutpat massa. Duis sodales, quam id eleifend pretium, felis tortor ullamcorper eros, ut euismod nisl nibh vel est. Vestibulum varius, quam sit amet placerat consectetur, est leo pretium ante, ut bibendum augue elit sit amet velit.</p><p>Donec congue ligula non felis viverra, sed aliquet nisl suscipit. Sed porta ultricies est tempor finibus. Sed tempor mollis nunc. Pellentesque posuere elit et elit varius commodo. Nulla facilisi. Vivamus condimentum nunc sit amet lacus condimentum sagittis at ut dui. Quisque in quam enim. Duis egestas, nisi quis auctor placerat, est sem pretium mi, nec pharetra tortor arcu eu magna. Nullam sed lectus ac nibh placerat vulputate id ut urna. Aenean ullamcorper sed sem id lobortis. Integer ornare bibendum maximus. Quisque venenatis eleifend lorem, at pharetra est fermentum semper. Vivamus turpis orci, molestie eget consequat nec, rutrum a quam. Morbi eu ullamcorper elit. Phasellus a vehicula velit.</p><p>Praesent dignissim sagittis leo ut porttitor. Integer nisi enim, tristique a ligula vel, mattis gravida metus. Praesent sed cursus turpis, pellentesque facilisis risus. Ut ut tortor elementum, euismod nisl nec, rhoncus justo. In lobortis tempus ipsum ut venenatis. Etiam a mi vel ante tempor aliquet sed nec leo. Sed euismod neque at tortor ultrices dapibus. Sed ipsum libero, viverra vel sem a, fringilla fringilla eros. Vivamus sit amet arcu malesuada mi mattis vulputate vel laoreet diam. Vestibulum eu tellus lectus.</p><p>Aenean risus tellus, posuere at ligula eu, elementum rhoncus lacus. Aenean non urna vulputate, aliquam eros ut, pretium ex. Morbi elementum erat vitae est dapibus interdum. Nam sed rhoncus nunc. Sed posuere ullamcorper eros, sed efficitur nisi maximus id. Sed nec aliquam ligula. Quisque ultricies pellentesque nulla, quis auctor eros blandit malesuada. Sed purus leo, imperdiet at justo id, bibendum convallis ex. Donec sagittis, urna vitae posuere viverra, purus purus imperdiet enim, id lacinia lacus velit sit amet neque. Fusce vestibulum tortor ac tortor venenatis vehicula. Donec nec lorem sed nunc pharetra finibus. Pellentesque porttitor augue ex, et mattis erat gravida in.</p>",
      "Weighting": 0,
      "DisableForSiteSearch": true,
      "CreatedByMemberId": "0",
      "ItemCategories": [
        "Group 2",
        "Sample Category"
      ],
      "ItemCategoryIdList": [
        1346,
        1348
      ],
      "ItemTags": [
        "blog posts",
        "demo"
      ],
      "Author": 2274,
      "Author_Name": "DEMO Author One",
      "Author_Url": "/demo-author-one",
      "Item_Rating": 0,
      "Image": "/images/template-courses.jpg",
      "ShowPageForSearchEngine": false,
      "MetaTitle": "",
      "SEOTitle": "",
      "MetaDescription": "",
      "CanonicalLink": "",
      "SocialMetaTags": "",
      "SeoPriority": 0.5,
      "EnableAMP": false,
      "AMPContent": "",
      "OpenGraphProperties": {
        "title": null,
        "type": null,
        "url": null,
        "locale": null,
        "image": null
      },
      "ExternalId": 0,
      "Params": {}
    },
    {
      "Id": 2470,
      "Name": "Sample2 Post Three",
      "Url": "/demo-custom-blog-2/sample2-post-three",
      "Url_List": [
        "/demo-custom-blog-2/sample2-post-three"
      ],
      "UrlSlug": "sample2-post-three",
      "ParentId": 2464,
      "ParentId_List": [
        2464
      ],
      "ParentName": "DEMO Custom Blog 2",
      "ParentUrl": "/demo-custom-blog-2",
      "TemplateName": "DEMO Companion Site",
      "Module_Alias": "BlogPost",
      "Module_ID": 1534,
      "Enabled": true,
      "ReleaseDate": "2019-11-05T00:00:00",
      "ExpiryDate": "2099-12-11T13:00:00",
      "SiteSearchKeywords": [],
      "Description": "<p>Cras elementum viverra nisl, at convallis urna tristique eu. Nam ut erat libero. In posuere turpis congue nunc rhoncus laoreet. In volutpat mauris vitae augue bibendum pharetra. Nullam pharetra, ligula ac ultricies porta, erat justo rhoncus nisl, sit amet tempus diam leo vitae turpis. Nam id lorem fringilla, finibus nulla efficitur, gravida lacus. Curabitur in molestie arcu. Sed eget tempor enim, vitae sagittis nisi. Sed porttitor euismod ex, accumsan lobortis quam lacinia quis. Aliquam dignissim vestibulum neque, ornare tristique elit sodales non. Interdum et malesuada fames ac ante ipsum primis in faucibus.</p><p>Aliquam id mattis elit, eu dictum sem. Suspendisse velit diam, pellentesque in commodo nec, tristique vel quam. Donec dapibus gravida volutpat. Nunc tellus metus, laoreet vel odio ut, fringilla posuere velit. Aliquam ut dignissim tellus, et condimentum eros. In aliquam leo nibh, sed facilisis nunc condimentum vitae. Duis vestibulum pellentesque orci, quis volutpat tellus commodo eget. Morbi congue hendrerit euismod. Maecenas vel porttitor sapien. Nam a leo vitae lectus rutrum feugiat. Sed mollis hendrerit odio, in porttitor metus cursus at. Sed vel tellus venenatis, maximus diam in, volutpat massa. Duis sodales, quam id eleifend pretium, felis tortor ullamcorper eros, ut euismod nisl nibh vel est. Vestibulum varius, quam sit amet placerat consectetur, est leo pretium ante, ut bibendum augue elit sit amet velit.</p><p>Donec congue ligula non felis viverra, sed aliquet nisl suscipit. Sed porta ultricies est tempor finibus. Sed tempor mollis nunc. Pellentesque posuere elit et elit varius commodo. Nulla facilisi. Vivamus condimentum nunc sit amet lacus condimentum sagittis at ut dui. Quisque in quam enim. Duis egestas, nisi quis auctor placerat, est sem pretium mi, nec pharetra tortor arcu eu magna. Nullam sed lectus ac nibh placerat vulputate id ut urna. Aenean ullamcorper sed sem id lobortis. Integer ornare bibendum maximus. Quisque venenatis eleifend lorem, at pharetra est fermentum semper. Vivamus turpis orci, molestie eget consequat nec, rutrum a quam. Morbi eu ullamcorper elit. Phasellus a vehicula velit.</p><p>Praesent dignissim sagittis leo ut porttitor. Integer nisi enim, tristique a ligula vel, mattis gravida metus. Praesent sed cursus turpis, pellentesque facilisis risus. Ut ut tortor elementum, euismod nisl nec, rhoncus justo. In lobortis tempus ipsum ut venenatis. Etiam a mi vel ante tempor aliquet sed nec leo. Sed euismod neque at tortor ultrices dapibus. Sed ipsum libero, viverra vel sem a, fringilla fringilla eros. Vivamus sit amet arcu malesuada mi mattis vulputate vel laoreet diam. Vestibulum eu tellus lectus.</p><p>Aenean risus tellus, posuere at ligula eu, elementum rhoncus lacus. Aenean non urna vulputate, aliquam eros ut, pretium ex. Morbi elementum erat vitae est dapibus interdum. Nam sed rhoncus nunc. Sed posuere ullamcorper eros, sed efficitur nisi maximus id. Sed nec aliquam ligula. Quisque ultricies pellentesque nulla, quis auctor eros blandit malesuada. Sed purus leo, imperdiet at justo id, bibendum convallis ex. Donec sagittis, urna vitae posuere viverra, purus purus imperdiet enim, id lacinia lacus velit sit amet neque. Fusce vestibulum tortor ac tortor venenatis vehicula. Donec nec lorem sed nunc pharetra finibus. Pellentesque porttitor augue ex, et mattis erat gravida in.</p>",
      "Weighting": 0,
      "DisableForSiteSearch": false,
      "CreatedByMemberId": "0",
      "ItemCategories": [
        "Group 1/G1 Sub Cat I",
        "Group 2/G2 Sub Cat II"
      ],
      "ItemCategoryIdList": [
        1349,
        1352
      ],
      "ItemTags": [
        "blog posts",
        "sample"
      ],
      "Author": 2274,
      "Author_Name": "DEMO Author One",
      "Author_Url": "/demo-author-one",
      "Item_Rating": 0,
      "Image": "/images/home-img-01.jpg",
      "ShowPageForSearchEngine": false,
      "MetaTitle": "",
      "SEOTitle": "",
      "MetaDescription": "",
      "CanonicalLink": "",
      "SocialMetaTags": "",
      "SeoPriority": 0.5,
      "EnableAMP": false,
      "AMPContent": "",
      "OpenGraphProperties": {
        "title": "My Open Graph Title",
        "type": "article",
        "url": "https://www.mywesite.com/demo-custom-blog-2/sample2-post-three",
        "locale": "en_US",
        "image": "https://www.mywesite.com/images/sample-image.jpg"
      },
      "ExternalId": 0,
      "Params": {}
    }
  ]
}

Accessing the Data

JSON Output

You can output the full JSON for your component data by referencing the root Liquid object {{this}} in your module’s layouts, or directly on your page, if using the collectionVariable parameter in your component tag.

For example:

{% component type: ... collectionVariable: "myData" %}

You can then render the JSON like so:

{{myData}}

For more details on using this approach, see Part 2 of the free ‘Learning Liquid Course’.

Rendering Property Values

This data is accessible in two main ways:

1. Using Liquid in the specified Layout via the this object.

{{this['url']}}

2. Directly on the Page or Template via a Liquid Collection if collectionVariable was added to the Component tag.

An example using collectionVariable with value "allPosts" to list all "Blog Posts" across the site:

Here we suppress any Layout from rendering by setting layout: "" as an empty attribute.

{% component type: "module", source: "Blog Posts", layout: "", collectionVariable: "allPosts" %}

Looping through the collection to render all the item URLs in a list, giving us:

  • /demo-html-blog/demo-html-post
  • /demo-custom-blog-2/sample2-post-one
  • /demo-custom-blog-2/sample2-post-three

The code:

<ul>
    {% for i in allPosts.items %}
        <li>{{i['url']}}</li>
    {% endfor %}
</ul>

Accessing a specific item within the collection. In this case the third item (zero based index), which in our example would render the value /demo-custom-blog-2/sample2-post-three

{{allPosts.items[2]['url']}}

List Posts from a specific Blog

If you have more than one Blog on your site the above examples will list Posts from all Blogs as one single collection. However, typically you'd want to list all Posts from only the Blog they belong to (their "parent" Blog).

To do this we add the filterBy and filterValue attributes to the Component tag.

Typically, you would be listing Blog specific Posts on your Blog detail page/index page. In which case you would be editing the 'General Blog Layout' to insert your Component tag, which would look like this:

{% component type: "module", source: "Blog Posts", layout: "List", filterBy: "parentId", filterValue: "{{this['id']}}" %}

As we are within the Blog's detail Layout (which represents the 'parent' Blog) we can reference its ID for the filter value using {{this['id']}} and instruct the Component tag to filter the Posts only by their parent (filterBy: "parentID") - giving us only the relevant Posts for the current Blog.

You may however, want to render a list of Posts on a standard page or within another modules layout, where the Post's parent ID (the Blog it belongs to) is not readily available to us in the Liquid scope. In this case you would need to manually hardcode the desired parent Blog's ID into the component tag in place of the above Liquid generated ID (filterValue: "1234").

To obtain the Blog's ID from the admin, go to that Blog's list view (where you can see all of the Posts) and note the number in the URL address bar shown after the parentID= parameter.

Counter

Along with the data output above, there is also a special liquid tag available {{counter}} which increments for each item. This tag is only available within Layouts when object: "item" is used in the Component tag.



Related Articles

  • Liquid Components
    module (Blog)

    This module component fetches data relating to Blogs. {% component type: "module", source: "Blog", layout:...
  • Content Modules
    Blogs

    Blogs provide a robust blogging platform allowing multiple Blogs per site with unlimited Blog Posts and custom layouts and behaviours.

External Resources


Please let us know if you have any other contributions or know of any helpful resources you'd like to see added here.


Questions?

We are always happy to help with any questions you may have.
Visit the Treepl Forum for community support and to search previously asked questions or send us a message at support@treepl.co and we will consult you as soon as possible.