Blog List Articles Pages or Posts

Blog or list of articles, pages or posts

Single Category Example

Any data within the page_o.category object can be referenced in an html page as follows:

 <!--#4DHTML page_o.category.description--> // Returns the description of the category

 
Featured articles

JSON example of category object. Include any data from the object in a template use  page_o.category.....

"UID": "818175AB2C8BAA4A90595F923B9428FD",
"lft": 42,
"rgt": 43,
"level": 2,
"path": "home/news-215",
"title": "MCS Sap Calculator",
"alias": "news-215",
"description": "",
"published": 1,
"params": {
    "category_layout": "",
    "image": "",
    "image_alt": ""
},
"metadesc": "",
"metakey": {
    "keywords": []
},
"metadata": {
    "author": "",
    "robots": ""
},
"created_time": "0000-00-00",
"modified_time": "2020-11-17",
"filepath": "",
"schema_article_type": {
    "option": "Collection",
    "label": "Collection",
    "default": ""
},
"schema_page_type": {
    "option": "CollectionPage",
    "label": "Collection Page",
    "default": ""
},
"link_count": 0,
"incoming_link_count": 0,
"breadcrumbs": {
    "breadcrumbs": [
        {
            "title": "Home",
            "class": "",
            "path": "index.html",
            "active": false,
            "home": 1
        },
        {
            "title": "News",
            "class": "",
            "path": "home/news-215",
            "active": false,
            "home": 0
        }
    ]
},
"keyphrase": null

Latest posts blog

In the example snippet below the page_o object contains a category object as described above plus a collection of articles  page_o.articles. Each article can be displayed via a For Each ... End For Each loop where the variable $item is the article in the collection. 

In the event that the category does not have any published content we test the length of the collection.

<!--#4DIF page_o.articles.length#0-->  <!--#4DENDIF-->

For each page in the collection defined as $item insert the content as $item using the filed names from the article. See single Article example 

<!--#4DHTML page_o.category.title-->
<!--#4DHTML page_o.category.description-->
<div class="row gy-6">
<!--#4DIF page_o.articles.length#0--> // do we have any pages in the collection
  <!--#4DEACH $item in page_o.articles--> // $item is each page or post in the page_o.articles collection

    <h5 class="post-title"><a href="<!--#4DHTML $item.path-->" // $item.path is the url
            rel="bookmark"><!--#4DTEXT $item.title--></a></h5> // title or page or post
            <!--#4DHTML $item.introtext--> 
                  <!--#4DIF $item.fulltext#""--> // Only show the full text if you have content.
                                    <!--#4DHTML $item.fulltext-->
                  <!--#4DENDIF-->
    <div class="post-meta down">
        <span class="author-name">
            <i class="fa fa-user-secret"></i> <!--#4DHTML $item.author-->
        </span>
  </div>
  <!--/column -->
  <!--#4DENDEACH-->
<!--#4DENDIF-->
</div>