Skip to content

getMainPageBlogArticles(int items_per_page)

The getMainPageBlogArticles method is used to get the BlogArticlesList object that represents a list of articles with main page flag checked.

Input parameters

items_per_page

int Number of items in a page of internal paginator. Parameter is optional. Default value is 10.

Returned value

The BlogArticlesList object.

Example

source
{% set mainPageArticles = ObjectApi.getMainPageBlogArticles() %}
{% for blogArticle in mainPageArticles %}
        <a href="{{ blogArticle.url }}" title="{{ blogArticle.name}}">
            {{ blogArticle.shortContent }} - {{ blogArticle.author }}
        </a>
{% endfor %}
output
<a href="/en/n/1" title="New T-shirts soon">
    Get ready for new T-shirt designs! - Author James
</a>
<a href="/en/n/2" title="Upcoming winter sale!">
    Soon we are starting the winter sale of thermal mugs. - Author Jenny
</a>