article
Các đối tượng "article" có các thuộc tính sau:
- article.author
- article.comments
- article.comments_count
- article.comments_enabled?
- article.comment_post_url
- article.content
- article.created_at
- article.excerpt
- article.excerpt_or_content
- article.id
- article.image
- article.image.src
- article.moderated?
- article.published_at
- article.tags
- article.title
- article.url
- article.user.account_owner
- article.user.bio
- article.user.email
- article.user.first_name
- article.user.last_name
- article.user.homepage
article.author
Returns the full name of the article's author.article.comments
Returns the published comments of an article. Returns an empty array if comments are disabled.article.comments_count
Returns the number of published comments for an 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/thu-thuat/1000194119-haravan/comments
article.content
Returns the content of an article.article.created_at
Returns the timestamp of when an article was created. Use the date filter to format the timestamp.Input
{{ article.created_at | date: "%a, %b %d, %y" }}
Output
Hai, Thg6 27, 16
article.excerpt
Returns the excerpt of an article.article.excerpt_or_content
Returns article.excerpt of an article if it exists. Returns article.content if an excerpt does not exist for the article.article.id
Returns the id of an article.article.image
Returns the article image. Use the img_url filter to link it to the image file on the Haravan hstatic. Check for the presence of the image first.{% if article.image %}{{ article | img_url: 'medium' }}{% endif %}
article.image.src
Returns the relative URL to the article image.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 an article was published. Use the date filter to format the timestamp.article.tags
Returns all the tags for an article.Input
{% for tag in article.tags %}
{{tag}}
{% endfor %}
Output
tag1 tag2 tag3 tag4
article.title
Returns the title of an article.article.url
Returns the relative URL of the article.{{ article.url }}