Community Topic page

The Community Topic page template is rendered when a user clicks a link to any community topic.

Available properties

Name Type Description
topic object A topic object
posts array An array of post objects
filters array An array of filter objects. Useful for filtering the posts in the topic
current_filter object The current filter object
sorters array An array of filter objects. Useful for sorting the posts in the topic. See Sorters below
current_sorter object The current filter object
promoted_articles array An array of promoted article objects
ticket_forms array An array of ticket form objects
help_center object A help_center object that holds information and settings about the current help center
settings object A settings object with custom settings for the current theme

Available helpers

You can use the following helpers in this page template. You can also use any built-in helpers, global helpers, or global advanced helpers.

Name Description
breadcrumbs Breadcrumbs for the Topic page. See breadcrumbs helper
pagination Pagination links. See pagination helper
subscribe A link to follow or unfollow new posts and comments in the topic. See subscribe

Sorters

Iterating through the sorters array of filter objects adds the following links to the page:

Link text Action
Newest post Sorts by post creation time in descending order
Recent activity Sorts by the most recent activity in descending order. Post activity are actions such as post created, comment created etc.
Votes Sorts by highest vote sum in descending order
Comments Sorts by largest number of comments in descending order

Example

<nav class="sub-nav">
  {{breadcrumbs}}
  {{search scoped=true}}
</nav>

<header class="page-header">
  <h1>
    {{#if topic.internal}}
      <span class="visibility-internal" data-title="{{t 'internal'}}">
        <span class="visibility-internal-icon"></span>
      </span>
    {{/if}}
    {{topic.name}}
  </h1>
  <span class="post-to-community">
    {{link 'new_post' role='button' topic_id=topic.id}}
  </span>
</header>

<p>{{topic.description}}</p>

<div class="topic-header">
  <span class="topic-filters">
    <span class="dropdown">
      <span class="dropdown-toggle">
        {{current_filter.label}}
      </span>
      <span class="dropdown-menu" role="menu">
        {{#each filters}}
          <a href="{{url}}" aria-selected="{{selected}}" role="menuitem">
            {{name}}
          </a>
        {{/each}}
      </span>
    </span>
    <span class="dropdown">
      <span class="dropdown-toggle">
        {{current_sorter.label}}
      </span>
      <span class="dropdown-menu" role="menu">
        {{#each sorters}}
          <a href="{{url}}" aria-selected="{{selected}}" role="menuitem">
            {{name}}
          </a>
        {{/each}}
      </span>
    </span>

  </span>
  <span class="topic-follow">
    {{subscribe}}
  </span>
</div>

{{#each posts}}
  <div class="post-overview {{#if featured}}post-featured{{/if}} {{#if pinned}}post-pinned{{/if}} clearfix">
    <span class="post-overview-info">
      <a href="{{url}}" title="{{title}}">{{title}}</a>
      <span class="meta-group">
        <span>{{author.name}}</span>
        <span>{{date created_at timeago=true}}</span>
      </span>
    </span>
    <span class="post-overview-count">
      <strong>{{comment_count}}</strong>
      {{t 'comment' count=comment_count}}
    </span>
    <span class="post-overview-count">
      <strong>{{vote_sum}}</strong>
      {{t 'vote' count=vote_sum}}
    </span>
    <span class="post-overview-status">
      {{#if status}}
        <span class="post-{{status.id}}">{{status.name}}</span>
      {{/if}}
    </span>
  </div>
{{/each}}

{{pagination}}