Community Post List page

The Community Post List page template is rendered when a user clicks the Posts link on any community page.

Available properties

Name Type Description
filters array An array of filter objects for the page
current_filter object The current filter object
sorters array An array of filter objects for the page. See Sorters below
current_sorter object The current filter object
posts array An array of post objects
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 Post index page. See breadcrumbs helper
pagination Pagination links. See pagination helper

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 includes actions such as creating a post, commenting on a post, 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}}
</nav>

<header class="page-header">
  <span class="dropdown">
    <span class="dropdown-toggle">
      <h1>{{t "community"}}</h1>
    </span>
    <span class="dropdown-menu" role="menu">
      {{link "topics" role="menuitem"}}
      {{link "posts" role="menuitem" selected="true"}}
    </span>
  </span>
  <span class="post-to-community">
    {{link "new_post" role="button"}}
  </span>
</header>

<div class="topic-header">
  <span class="topic-filters">
    <span class="dropdown">
      <span class="dropdown-toggle">
        {{current_filter.selected_name}}
      </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.selected_name}}
      </span>
      <span class="dropdown-menu" role="menu">
        {{#each sorters}}
          <a href="{{url}}" aria-selected="{{selected}}" role="menuitem">
            {{name}}
          </a>
        {{/each}}
      </span>
    </span>
  </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}}