{{reverse}} helper

The {{reverse}} helper is useful if you need to reverse items in a specific collection e.g. tags listing.


{{reverse collection}}


{{#each @website.contentStructure.tags}}
   {{#checkIf '==' 'test'}}
      {{#if this.postsNumber}}
         {{reverse this.posts}}
         {{#each this.posts}} {{! this output is reversed }}
         {{reverse this.posts}}
         There are no posts connected with tag name "test"

Important! You should restore original ordering after use of the modified output. That's why our example contains double call of the {{reverse}} helper - the first call reverse the order of elements and after getting a reversed output we reverse the collection again to get original ordering.


What are you waiting for?

Start building your site today.

  1. 1 Download Publii
  2. 2 Write your content
  3. 3 Publish your site
Create website