hugolib: Add ability to sort by frontmatter parameters

This commit is contained in:
John Feminella authored and Bjørn Erik Pedersen committed 2017-02-10 20:01:25 +07:00
1 parent 6693e6c53e
commit 435bb858de
1 file changed
+12
+12
View File
@@ -237,6 +237,18 @@ your list templates:
</li>
{{ end }}
### Order by Parameter
Order based on the specified frontmatter parameter. Pages without that
parameter will use the site's `.Site.Params` default. If the parameter is not
found at all in some entries, those entries will appear together at the end
of the ordering.
The below example sorts a list of posts by their rating.
{{ range (.Data.Pages.ByParam "rating") }}
<!-- ... -->
{{ end }}
### Reverse Order
Can be applied to any of the above. Using Date for an example.