assign behavior
when i wrote, {{site.pages | sort: "date"}},i had the right order.
then i wrote, {% assign page_list = site.pages | sort:"date" %}, no effect.
i am using jekyll-bootstrap, downloaded from github
I believe that when you use filters inside a Liquid tag ({% sometag %}) you have to remove the spaces in the filter expression. So, your code would become this:
{% assign page_list = site.pages|sort:"date" %}
I'm sorry,it's no use.
Actually, my code is like this:
{% for tag in site.tags %} {% if tag[0] == "xxx" %}
-
{% assign pages_list= tag[1]|sort:"date" %}
{% include JB/pages_list %}
I got the reverse order.
Currently, I am using:
JB/reverse_pages_list ,it's like this:
{% for item in pages_list reversed %} xxx {% endfor %}
@zhuzhonghua i did not quite get your last comment, but i think that @nickpearson is right.
have a look at this example:
template = Liquid::Template.parse("
{% assign p = products | sort %}
{% for product in p %} {{ product }} {% endfor %}
")
template.render('products' => ['zzzz', 'aaaa'] )
# => aaaa zzzz
Closing. Please re-open if this is still an issue.