Skip to content

BlogArticle

The BlogArticle object represents a single blog article in the storefront.

classDiagram
  direction LR
  BlogArticle --> BlogCategoriesList
  BlogArticle --> BlogCommentsList
  BlogArticle --> BlogTagsList
  BlogArticle --> BlogFilesList
  BlogArticle --> Date
  BlogArticle --> BlogArticleUrl
  BlogCategoriesList "1" --o "*" BlogCategory
  BlogCommentsList "1" --o "*" BlogComment
  BlogTagsList "1" --o "*" BlogTag
  BlogFilesList "1" --o "*" BlogFile
  class BlogCategory{
  }
  class BlogCategoriesList{
  } 
  class BlogComment{
  }
  class BlogCommentsList{
  }
  class BlogTag{
  }
  class BlogTagsList{
  }
  class BlogFile{
  }
  class BlogFilesList{
  }
  class Date{
  }
  class BlogArticleUrl{
  }
  class BlogArticle{
    int id
    string name
    string content
    string shortContent
    string author
    Url image
    Date createdAt
    BlogArticleUrl url
    BlogCategoriesList categories
    BlogCommentsList comments
    BlogTagsList tags
    BlogFilesList files
    Metafields metafields
  }

Properties

Attribute name Type Description
id int The unique identifier of the blog article
name string The title of the blog article
content string Content of the blog article.
shortContent string Short content of the blog article.
author string Author name of the blog article.
image null|Url The Url object representing the image url of the blog article.
createdAt Date The Date object representing a date that article was created.
url BlogArticleUrl The BlogArticleUrl object that represents the url to the blog article.
categories BlogCategoriesList Reference to the BlogCategoriesList object that represents the category list of BlogCategory objects associated with this article.
comments BlogCommentsList Reference to the BlogCommentsList object that represents the comment list of BlogComment objects associated with this article.
tags BlogTagsList Reference to the BlogTagsList object that represents the tags list of BlogTag objects associated with this article.
files BlogFilesList Reference to the BlogFilesList object that represents the files list of BlogFile objects associated with this article.
metafields Metafields Reference to the Metafields object that provides access to the namespaced containers for key - value pairs of data.

Examples

id property

{{ blogArticle.id }}
1

name property

{{ blogArticle.name }}
example name

content property

{{ blogArticle.content }}
example content

shortContent property

{{ blogArticle.shortContent }}
example short content

author property

{{ blogArticle.author }}
example author

image property

{{ blogArticle.image }}
/link/to/image

createdAt property

{{ blogArticle.createdAt }}
21-06-2022

url property

{{ blogArticle.url }}
/en/n/1

categories property

{% for category in blogArticle.categories %}
    <h3>{{ category.name }}</h3>
        <a href="{{ category.url }}" title="{{ category.title }}">Link to category</a>
    <br>
{% endfor %}
<h3>Our laboratory test</h3>
<a href="/en/n/category/laboratory/1" title="Laboratory">Link to category</a>
<br>
<h3>Product adverts</h3>
<a href="/en/n/category/adverts/2" title="Adverts">Link to category</a>
<br>

comments property

{% for comment in blogArticle.comments %}
    <b>{{ comment.userName }} -- ({{ comment.createdAt }})</b>
    <p>{{ comment.content }}</p>
    <br>
{% endfor %}
<b>Jenny -- (17-06-2022 10:10)</b>
<p>Great article! Now I know what materials they use in their T-shirts.</p>
<br>
<b>Tommy -- (19-06-2022 05:45)</b>
<p>Very useful knowledge. I am waiting impatiently for the next entries.</p>
<br>

tags property

{% for tag in blogArticle.tags %}
    <b>{{ tag.name }}</b>
    <br>
{% endfor %}
<b>daily news</b>
<br>
<b>rebranding</b>
<br>

files property

{% for file in blogArticle.files %}
    <b>{{ file.name }}</b>
    <p>{{ file.description }}</p>
    <a href="{{ file.url.getAbsolute() }}" title="{{ file.name }}">Download file</a>
    <br>
{% endfor %}
<b>Leaflet</b>
<p>Read more about our strategy</p>
<a href="https://example.com/en/n/download/1/leaflet.pdf" title="leaflet.pdf">Download file</a>
<br>
<b>Voucher</b>
<p>A little discount for some of products</p>
<a href="https://example.com/en/n/download/2/voucher-prod.pdf" title="voucher-prod.pdf">Download file</a>
<br>

metafields property

value: {{ blogArticle.metafields.someNamespaceName.key }}
value: example-value