Difference between revisions of "Liquid Template Variables - article"
From Spiffy Stores Knowledge Base
m (→article.type) |
m (→article.type) |
||
Line 61: | Line 61: | ||
== <code>article.type</code> == | == <code>article.type</code> == | ||
Returns the type of the object, in this case, ''article''. | Returns the type of the object, in this case, ''article''. | ||
+ | == <code>article.comments</code> == | ||
+ | Returns the published comments for the article. Returns an empty array if comments are disabled. | ||
+ | == <code>article.comments_count</code> == | ||
+ | Returns the number of published comments for the article. | ||
+ | == <code>article.comments_enabled?</code> == | ||
+ | Returns <i>true</i> if comments are enabled. | ||
+ | == <code>article.moderated?</code> == | ||
+ | Returns <i>true</i> if comments for the blog are moderated. | ||
+ | == <code>article.comment_post_url</code> == | ||
+ | Returns the relative URL for the POST requests that are used to create new comments. | ||
+ | <pre> | ||
+ | {{ article.comment_post_url }} | ||
+ | </pre> | ||
+ | |||
== <code>article.tags</code> == | == <code>article.tags</code> == | ||
Returns all the tags for the article. | Returns all the tags for the article. |
Latest revision as of 14:56, 29 March 2022
The Liquid template variable article has the following attributes:
Contents
- 1 article.id
- 2 article.title
- 3 article.author
- 4 article.content
- 5 article.synopsis
- 6 article.more_tag?
- 7 article.created_at
- 8 article.updated_at
- 9 article.published_at
- 10 article.url
- 11 article.blog
- 12 article.type
- 13 article.comments
- 14 article.comments_count
- 15 article.comments_enabled?
- 16 article.moderated?
- 17 article.comment_post_url
- 18 article.tags
- 19 article.image
- 20 article.images_count
- 21 Further Reference
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 %b" }}
article.updated_at
Returns the date and time that the article was last updated.
Revised on: {{ article.updated_at | date: "%Y %b" }}
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.
Published on: {{ article.published_at | date: "%Y %b" }}
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.comments
Returns the published comments for 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.
article.moderated?
Returns true if comments for the blog are moderated.
article.comment_post_url
Returns the relative URL for the POST requests that are used to create new comments.
{{ article.comment_post_url }}
article.tags
Returns all the tags for the article.
{% for tag in article.tags %} {{ tag }} {% endfor %}
article.image
The image associated with an article is automatically extracted from the article text. It's usual to embed images in an article as this gives you full control on the appearance of the article. When you embed an image within the article text, the URL of the first such image will be returned.
article.images_count
Return the number of images associated with this article. If an image is found within the text of the article, a value of 1 will be returned. Otherwise, 0 is returned.