The article object
The article
object has the following attributes:
article.author
Returns the full name of the article's author.
article.comments
Returns the published comments of the article. Returns an empty array if comments are disabled.
article.comments_count
Returns the number of published comments for the article.
article.comments_enabled?
Returns true
if comments are enabled. Returns false
if comments are disabled.
article.comment_post_url
Returns the relative URL where POST requests are sent to when creating new comments.
Input
{{ article.comment_post_url }}
Output
/blogs/news/10582441-sale-starts-today/comments
article.content
Returns the content of the article.
article.created_at
Returns the timestamp of when the article was created. Use the date filter to format the timestamp.
Input
{{ article.created_at | date: "%a, %b %d, %y" }}
Output
Fri, Sep 16, 11
article.excerpt
Returns the excerpt of the article.
article.excerpt_or_content
Returns article.excerpt
of the article if it exists. Returns article.content
if an excerpt does not exist for the article.
article.handle
Returns the handle of the article.
article.id
Returns the id of the article.
article.image
Returns the article's image object.
article.image.alt
Returns the article image's alt
text.
article.image.src
Returns the relative URL to the article image.
Input
{{ article.image.src | img_url: '500x' }}
Output
//cdn.shopify.com/s/files/1/0087/0462/blogs/summer_article_500x.png?v=1334084726
article.moderated?
Returns true
if the blog that the article belongs to is set to moderate comments. Returns false
if the blog is not moderated.
article.published_at
Returns the date/time when the article was published. Use the date filter to format the timestamp.
article.tags
Returns all the tags for the article.
Input
{% for tag in article.tags %}
{{ tag }}
{% endfor %}
Output
news new-products photography
Total tag count
When looping through article.tags
, you can print how many times a tag is used with tag.total_count
. This number shows visitors how many blog posts have been tagged with a particular tag:
Input
{% for tag in article.tags %}
{{ tag }} ({{ tag.total_count }})
{% endfor %}
Output
news (5) new-products (2) photography (1)
article.title
Returns the title of the article.
article.updated_at
Returns the date/time when the article was updated. Use the date filter to format the timestamp.
article.url
Returns the relative URL of the article.
Input
{{ article.url }}
Output
/blogs/news/10582441-my-new-article
article.user
Returns an object with information about the article's author. This information can be edited in the Staff accounts options on the Account page in your Shopify admin.
article.user.account_owner
Returns true
if the author of the article is the account owner of the store. Returns false
if the author is not the account owner.
article.user.bio
Returns the bio of the author of the article.
article.user.email
Returns the email of the author of the article.
article.user.first_name
Returns the first name of the author of the article.
article.user.homepage
Returns the home page of the article author.
article.user.image
Returns the image object of the author of the article.
Input
{% if article.user.image %}
{{ article.user.image | img_url: '200x200' }}
{% endif %}
Output
//cdn.shopify.com/s/files/1/0087/0462/users/user-image_200x200.png?v=1337103726
article.user.last_name
Returns the last name of the author of the article.