Difference between revisions of "Liquid Template Variables - article"

From Spiffy Stores Knowledge Base

Line 40: Line 40:
  
 
<pre>Revised on: {{ article.updated_at | date: "%Y %h" }}</pre>
 
<pre>Revised on: {{ article.updated_at | date: "%Y %h" }}</pre>
 +
 +
== <code>article.published_at</code> ==
 +
 +
Returns the date and time that the article was published. Setting the article's visibility to '''hidden''' clears the '''published_at''' timestamp, and setting the article's visibility to '''published''' sets it to the current time.
 +
 +
If the '''published_at''' timestamp has not been set, then the '''created_at''' timestamp will be used.
  
 
== <code>article.url</code> ==
 
== <code>article.url</code> ==

Revision as of 18:23, 15 March 2016

The Liquid template variable article has the following attributes:

article.id

Returns the unique internal number of the article.

This is normally only for internal usage.

article.title

Returns the title of this article.

article.author

Returns the name of the author of this article.

article.content

Returns the content of this article.

article.synopsis

Returns the content of this article, up to a '<!--more-->' tag, if it exists.

This is useful for providing a summary of blog articles, without including the full text of the article.

article.more_tag?

Returns true if the '<!--more-->' tag is present in the article.

article.created_at

Returns the creation date and time of the article.

{{ article.created_at | date: "%Y %h" }}

article.updated_at

Returns the date and time that the article was last updated.

Revised on: {{ article.updated_at | date: "%Y %h" }}

article.published_at

Returns the date and time that the article was published. Setting the article's visibility to hidden clears the published_at timestamp, and setting the article's visibility to published sets it to the current time.

If the published_at timestamp has not been set, then the created_at timestamp will be used.

article.url

The is the relative URL address of the article.

article.blog

This is the blog that this article belongs to.

article.type

Returns the type of the object, in this case, 'article'.

article.images_count

Return the number of images associated with this article. As articles do not support associated images at this stage, the value of 0 is always returned.