0

I'd like to sort the post in the reverse sequence, but there was an error. I had tried to remove | , however, it not work well.

callback([
{% for post in site.posts reversed | sort: title %}
  {
    "text": "{{post.title | replace:'"','\"'}}",
    "href": "{{site.url}}{{site.baseurl}}{{post.url}}"
  } {% unless forloop.last %},{% endunless%}
{% endfor %}
])

There are Expected end_of_string but found pipe errors.

Liquid Warning: Liquid syntax error (line 2): Expected end_of_string but found pipe in "post in site.posts reversed | sort: title" in proselinks.jsonp
Olsen
  • 1
  • 1
  • Please be specific about the problem you are facing. Have a look at https://stackoverflow.com/help/how-to-ask – kg99 Dec 15 '20 at 09:43
  • Double typo: the liquid filter is [**`reverse`**](https://shopify.github.io/liquid/filters/reverse/) and not `reversed`. Then you are missing a pipe between your array and the `reverse` filter. So: `{% for post in site.posts | reverse | sort: title %}` – β.εηοιτ.βε Dec 17 '20 at 21:04

0 Answers0