module (Blog)
This module component fetches data relating to Blogs.
{% component type: "module", source: "Blog", layout: "Blog List Layout" %}
Parameters and Options
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'.
Blog (default)
Blog List Layout (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.
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module
Remove spaces from custom property names here.
<your value>
Liquid variables can be used here also. If present but no value set, no items will be returned.
id
parentid
name
weighting
url
urlslug
releasedate
expirydate
LastUpdatedDate
Author
ItemCategories
ItemTags
<CustomPropertyName>
...and any other top level properties available for the module
Remove spaces from custom property names here.
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.
false (default)
true
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.false (default)
true
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.
10 (default)
<integer>
true (default)
false
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.
false (default)
true
<Your custom message>
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.
item (default)
collection
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).<yourLiquidVariableName>
Your collectionVariable value must only contain English letters, numbers or underscores. Spaces or special characters are not supported.
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.
{'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.
<your custom value>
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
(Blogs), but is otherwise the default structure you will get from this Component.
{
"Params": {
"source": "Blog",
"layout": "",
"type": "module",
"collectionvariable": "allBlogs"
},
"Pagination": {
"CurrentPage": 1,
"ItemsPerPage": 10,
"NumberOfPages": 1,
"TotalItemsCount": 3
},
"Parent": {
"Id": 2141,
"Name": "module (Blog)",
"Url": "/component-types/module-blog",
"Url_List": [
"/component-types/module-blog"
],
"UrlSlug": "module-blog",
"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-03T23:00:00",
"ExpiryDate": "2099-12-09T00:00:00",
"SiteSearchKeywords": [],
"Description": "<p>This module component fetches data relating to Blogs.</p>\n\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\n\n\n{% component type: \"snippet\", alias: \"section_parameters\" %}\n\n{% component type: \"json\", source_type:\"string\", source:\"{{tabularData}}\", layout:\"/snippets/tabularJSON.layout\" %}\n</section>\n\n{% component type: \"snippet\", alias: \"section_output\" %}\n\n{% component source: \"Blog\", layout: "", type: \"module\", collectionVariable: \"allBlogs\" %}\n<p>The below example has 3 sample <code>items</code> (Blogs), but is otherwise the default structure you will get from this Component.</p>\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{allBlogs}}\", lang: \"json\" %}\n</section>\n\n{% component type: \"snippet\", alias: \"section_accessing_data\" %}\n\n<p>This data is accessible in two main ways:</p>\n\n<p>1. Using Liquid in the specified Layout via the <code>this</code> object.</p>\n\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\n\n<p>2. Directly on the Page or Template via a Liquid Collection if <code>collectionVariable</code> was added to the Component tag.</p>\n\n<p>An example using <code>collectionVariable</code> with value \"allBlogs\" to list all \"Blog\" across the site:</p>\n<p class=\"notice-note\">Here we suppress any Layout from rendering by setting <code>layout: \"\"</code> as an empty attribute.</p>\n\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\n\n<p><em>Looping through the collection to render all the item URLs in a list, giving us:</em></p>\n\n<ul>\n \n <li>/demo-custom-blog</li>\n \n <li>/demo-custom-blog-2</li>\n \n <li>/demo-html-blog</li>\n \n</ul>\n<br>\n<p><em>The code:</em></p>\n\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\n\n<p><em>Accessing a specific item within the collection. In this case the second item (zero based index), which in our example would render the value <code>/demo-custom-blog-2</code></em></p>\n\n{% component type: \"snippet\", alias: \"code_block_processor\", data: \"{{data}}\", lang: \"liquid\" %}\n</section>\n</section>\n\n{% component type: \"snippet\", alias: \"section_counter\" %}\n</section>\n",
"Weighting": 970,
"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-blogs\">Demo Site Listing All Blogs</a></li></ul>",
"AdditionalRelatedArticle": 0,
"AdditionalRelatedArticle2": 0,
"Authors": "2418",
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"ExternalId": 0,
"Params": {
"type": "snippet",
"alias": "section_output",
"data": "\n{% component type: \"module\", source: \"Blog\", layout: \"Blog List Layout\" %}\n",
"lang": "liquid",
"name": "SECTION Output",
"content": "<section id=\"secOutput\">\n <h2>Liquid Output</h2>",
"enabled": true,
"required": "true",
"values": "Blog List Layout <em>(default)</em><br><Your Layout name>"
}
},
"Items": [
{
"Id": 2286,
"Name": "DEMO Custom Blog",
"Url": "/demo-custom-blog",
"Url_List": [
"/demo-custom-blog"
],
"UrlSlug": "demo-custom-blog",
"ParentId": 1528,
"ParentId_List": [
-1
],
"ParentName": "",
"ParentUrl": "",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "Blog",
"Module_ID": 1528,
"Enabled": true,
"ReleaseDate": "2018-12-14T18:00:00",
"ExpiryDate": "2099-12-10T18:00:00",
"SiteSearchKeywords": [],
"Description": "<p>This is a description for my blog.<br>\r\nIt has Categories and Tags applied and can be filtered by Category, Tag and Month.<br>\r\nPagination is also enabled.</p>",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": "",
"type": "",
"url": "",
"locale": "",
"image": ""
},
"ExternalId": 0,
"Params": {}
},
{
"Id": 2464,
"Name": "DEMO Custom Blog 2",
"Url": "/demo-custom-blog-2",
"Url_List": [
"/demo-custom-blog-2"
],
"UrlSlug": "demo-custom-blog-2",
"ParentId": 1528,
"ParentId_List": [
-1
],
"ParentName": "",
"ParentUrl": "",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "Blog",
"Module_ID": 1528,
"Enabled": true,
"ReleaseDate": "2019-11-06T00:00:00",
"ExpiryDate": "2099-12-12T00:00:00",
"SiteSearchKeywords": [],
"Description": "<p>This is a description for my blog.<br>\nIt has Categories and Tags enabled and can be filtered by Keyword/Search, Category, Tag and Month.<br>\nFor the depreciated blog layout <a href=\"/demo-custom-blog\">see here</a>.\n</p>",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"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": 2279,
"Name": "DEMO HTML Blog",
"Url": "/demo-html-blog",
"Url_List": [
"/demo-html-blog"
],
"UrlSlug": "demo-html-blog",
"ParentId": 1528,
"ParentId_List": [
-1
],
"ParentName": "",
"ParentUrl": "",
"TemplateName": "DEMO Companion Site",
"Module_Alias": "Blog",
"Module_ID": 1528,
"Enabled": true,
"ReleaseDate": "2018-11-25T18:00:00",
"ExpiryDate": "2099-12-11T07:00:00",
"SiteSearchKeywords": [],
"Description": "",
"Weighting": 0,
"DisableForSiteSearch": false,
"CreatedByMemberId": "0",
"ItemCategories": [],
"ItemCategoryIdList": [],
"ItemTags": [],
"Author": 0,
"Author_Name": "",
"Author_Url": "",
"Item_Rating": 0,
"ShowPageForSearchEngine": true,
"MetaTitle": "",
"SEOTitle": "",
"MetaDescription": "",
"CanonicalLink": "",
"SocialMetaTags": "",
"SeoPriority": 0.0,
"EnableAMP": false,
"AMPContent": "",
"OpenGraphProperties": {
"title": null,
"type": null,
"url": null,
"locale": null,
"image": null
},
"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 "allBlogs" to list all "Blog" across the site:
Here we suppress any Layout from rendering by setting layout: ""
as an empty attribute.
{% component type: "module", source: "Blog", layout: "", collectionVariable: "allBlogs" %}
Looping through the collection to render all the item URLs in a list, giving us:
- /demo-custom-blog
- /demo-custom-blog-2
- /demo-html-blog
The code:
<ul>
{% for i in allBlogs.items %}
<li>{{i['url']}}</li>
{% endfor %}
</ul>
Accessing a specific item within the collection. In this case the second item (zero based index), which in our example would render the value /demo-custom-blog-2
{{allBlogs.items[1]['url']}}
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 Post)
This module component fetches data relating to Blog Posts. {% component type: "module", source: "Blog... - 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@webinone.com and we will consult you as soon as possible.