QUANTM7 Docs
QuillObjects

Blog & Article

Blog and article objects for listing posts, showing content, and building a blog index.

The blog and article objects power your store's blog. A blog is a collection of articles. Each article has a title, body content, author, tags, and an optional image.

Blog object

The blog object is available on blog listing pages. It holds the blog title and its list of articles.

PropertyTypeDescription
blog.idnumberThe unique blog ID
blog.titlestringThe blog title
blog.handlestringThe URL handle
blog.urlstringThe full blog URL
blog.articlesarrayAll published articles
blog.articles_countnumberTotal number of published articles
blog.tagsarrayAll tags used across the blog's articles
blog.categoriesarrayBlog categories

Blog listing page

<h1>{{ blog.title }}</h1>

{% paginate blog.articles by 12 %}
  {% for article in blog.articles %}
    <div class="article-card">
      {% if article.image %}
        <img src="{{ article.image | img_url: '600x' }}" alt="{{ article.title }}" />
      {% endif %}
      <h2><a href="{{ article.url }}">{{ article.title }}</a></h2>
      <p class="meta">{{ article.published_at | date: '%d %B %Y' }} by {{ article.author }}</p>
      <p>{{ article.excerpt_or_content | truncatewords: 30 }}</p>
    </div>
  {% endfor %}

  {{ paginate | default_pagination }}
{% endpaginate %}

Tag filtering

The blog.tags array lets you build a tag filter for the blog index:

<div class="blog-tags">
  <a href="{{ blog.url }}">All</a>
  {% for tag in blog.tags %}
    <a href="{{ blog.url }}/tagged/{{ tag | handleize }}">{{ tag }}</a>
  {% endfor %}
</div>

Category filtering

{% for category in blog.categories %}
  <a href="{{ blog.url }}/category/{{ category.handle }}">{{ category.name }}</a>
{% endfor %}

Article object

The article object represents a single blog post. It is available on the article detail page and inside blog.articles loops.

PropertyTypeDescription
article.idnumberThe unique article ID
article.titlestringThe article title
article.handlestringThe URL handle
article.urlstringThe full article URL
article.authorstringThe author name
article.author_avatarstringThe author's avatar image URL
article.contentstringThe full article body as HTML
article.excerptstringThe excerpt (short summary)
article.excerpt_or_contentstringThe excerpt if set, otherwise the full content
article.imageimageThe featured image
article.published_atstringThe publish date
article.created_atstringWhen the article was created
article.updated_atstringWhen the article was last updated
article.tagsarrayTags on this article
article.categoryobjectThe article's category (name, handle)
article.is_featuredbooleanWhether this article is marked as featured
article.reading_timenumberEstimated reading time in minutes

Article detail page

<article>
  <header>
    <h1>{{ article.title }}</h1>
    <p>
      {% if article.author_avatar %}
        <img src="{{ article.author_avatar }}" alt="{{ article.author }}" class="avatar" />
      {% endif %}
      By {{ article.author }}
      on {{ article.published_at | date: '%d %B %Y' }}
      {% if article.reading_time %}
        &middot; {{ article.reading_time }} min read
      {% endif %}
    </p>
  </header>

  {% if article.image %}
    {{ article.image | image_tag: class: 'article-hero' }}
  {% endif %}

  <div class="article-body">
    {{ article.content }}
  </div>

  {% if article.tags.size > 0 %}
    <footer class="article-tags">
      {% for tag in article.tags %}
        <a href="{{ blog.url }}/tagged/{{ tag | handleize }}">{{ tag }}</a>
      {% endfor %}
    </footer>
  {% endif %}
</article>

Pull featured articles into a homepage or sidebar:

{% for article in blog.articles %}
  {% if article.is_featured %}
    <div class="featured-post">
      <h3><a href="{{ article.url }}">{{ article.title }}</a></h3>
      <p>{{ article.excerpt | truncatewords: 20 }}</p>
    </div>
  {% endif %}
{% endfor %}

Sections

Each article can have structured content sections (the same section types used on pages). Use article.sections to render rich content beyond plain HTML:

PropertyTypeDescription
article.sectionsarrayContent sections for the article body

Accessing blogs by handle

You can access any blog by its handle using the global blogs object:

{% assign news = blogs['news'] %}
{% for article in news.articles limit: 3 %}
  <a href="{{ article.url }}">{{ article.title }}</a>
{% endfor %}

This is useful for showing recent posts in a sidebar or footer section on pages that are not part of the blog.

On this page