assemble / assemble.io

Website and documentation for Assemble.

Home Page:http://assemble.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sorting collection via task options example does not work

serebrov opened this issue · comments

Note: this issue is related to #126, but it is not the same. #126 about "withSort" helper usage and this one about task options usage.

The collection sorting example (http://assemble.io/docs/Collections.html) looks like this:

assemble: {
  options: {
    pages: [
      {data: {title: 'Post #1' }, content: '{{md "blog/post1.md"}}' },
      {data: {title: 'Post #2' }, content: '{{md "blog/post2.md"}}' },
    ],
    collections: [
      {
        title: 'pages',
        sortorder: 'desc' 
      }
    ]
  }
}

Similar example is for "tags" collection.
Such configuration (with title: 'pages') does not work and name: "pages" should be used instead:

assemble: {
  options: {
    pages: [
      {data: {title: 'Post #1' }, content: '{{md "blog/post1.md"}}' },
      {data: {title: 'Post #2' }, content: '{{md "blog/post2.md"}}' },
    ],
    collections: [
      {
        name: 'pages',
        sortorder: 'desc' 
      }
    ]
  }
}

There's a pending PR on the assemble repo that might fix this. I'll be taking a look at it today.