GitHub Download

{{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.


Get the latest Publii news, updates and more delivered directly to your email inbox

You can change your mind at any time by clicking the unsubscribe link in the footer of any email you receive from us, or by contacting us at By clicking below, you agree that we may process your information in accordance with our Privacy Policy.