Article page

The Article page template is rendered when a user clicks a link to any article in Help Center.

Available properties

You can use the following properties in the Article page template.

Name Type Description
article object Anarticleobject
attachments array An array ofattachment对象
comments array An array of articlecomment对象
comment_sorters array An array offilter对象. Useful for sorting the comments. See排序ersbelow
promoted_articles array An array of promotedarticle对象
section object Asectionobject. The object'sarticlesproperty contains only the first 10 articles for performance reasons
ticket_forms array An array ofticket form对象
help_center object Ahelp_centerobject that holds information and settings about the current help center
settings object Asettingsobject with custom settings for the current theme
signed_in boolean Whether the user is logged in or not
featured_posts array An array of featuredpost对象

Available helpers

You can use the following helpers in this page template. You can also use anybuilt-in helpers,global helpers, orglobal advanced helpers.

Name Description
breadcrumbs Breadcrumbs for the article page. Seebreadcrumbs helper
pagination Pagination links. Seepagination helper
share 共享的元素。看到share helper
subscribe A link to follow or unfollow new comments in the article
form A form for data input. See bellow theavailable formsfor this page
related_articles A list of related articles. Seerelated articles helper
request_callout A link to submit a new request, if available. Seerequest_callout helper
comment_callout A link to submit a new comment, if available. Seecomment_callout helper

Available forms

You can add the following form to the Article page template:

Name Description
comment A form to create a new article comment

Use theformhelper to insert it. SeeForm Helper.

Available identifiers

The followingidentifiersare available in this page:

Identifier Form Field(s) Description
body comment textarea, wysiwyg Identifies a text field for article comments

排序ers

Iterating through thecomment_sortersarray offilter对象adds the following links to the page:

Link text Action
Date 排序s by most recent comment creation time in descending order
Votes 排序s by highest vote sum in descending order

Official comments are always given the highest priority and shown at the top.

Example

             
<navclass="sub-nav clearfix">{{breadcrumbs}}{{subscribe}}nav><articleclass="main-column"><headerclass="article-header clearfix"><h1>{{article.title}}h1><divclass="article-metadata"><divclass="article-avatar"><imgsrc="{{article.author.avatar_url}}"alt="Avatar">div><divclass="article-author">{{article.author.name}}div><divclass="article-updated">{{article.updated_at}}div>div>header><divclass="article-body markdown">{{article.body}}div><footerclass="article-footer clearfix">{{article.vote 'up' class='article-vote-up' selected_class='article-voted' role='button'}}{{article.vote 'down' class='article-vote-down' selected_class='article-voted' role='button'}}{{share}}footer><sectionclass="article-comments"><divclass="article-comments-header"><h2>Commentsh2><divclass="comment-sorters">{{#each comment_sorters}}<aaria-selected="{{selected}}"href="{{url}}">{{name}}a>{{/each}}div>div><ul>{{#each comments}}<liclass="comment"><divclass="comment-vote vote">{{vote 'up' class='vote-up' selected_class='vote-voted'}}{{vote 'sum' class='vote-sum'}}{{vote 'down' class='vote-down' selected_class='vote-voted'}}div><divclass="comment-container">On {{date created_at}}, {{author.name}} wrote: {{body}}div>li>{{/each}}ul>{{#form 'comment' class='comment-form'}}<divclass="comment-avatar">{{user_avatar class='user-avatar'}}div><divclass="comment-container">{{wysiwyg 'body' rows='4'}}<divclass="comment-form-controls">{{input type='submit'}}div>div>{{/form}}section>article>