Sort pages by multiple keys

In my list.html layout I want to sort my pages so that the lowest weight number comes first and, for pages with same weight, sort by lastmod in reverse (desc order). Here is my unsuccessful attempt.

{{range ((.Data.Pages.ByParam "weight").ByParam "lastmod").Reverse }}

Any idea?

This seems to work:

{{range (.Data.Pages.ByParam "lastmod").Reverse.ByParam "weight" }}