Hugo: Zero Weight should not be considered in page sorting

Created on 6 Nov 2016  路  5Comments  路  Source: gohugoio/hugo

Most helpful comment

this commit (https://github.com/spf13/hugo/commit/4b4ab4755339a8c1d034be1f75b323d585dac1df) breaks expected sorting.

{{ range .Data.Pages.ByWeight.Reverse }}
output: 0 0 20161200 20161000 450 100 50 10

output expected: 20161200 20161000 450 100 50 10 0 0

All 5 comments

Unweighted pages should have a default weight (e.g. 0), and then the sorting should be consistent for promoting and demoting pages.

This would be consistent if the sorting is _descending_ according to weight
-- i.e. putting a positive weight promotes a page, a negative weight demotes a page.

I agree, but that would break stuff.

It was not a bug, it was a feature 馃憥
I gave set some huge values to some posts' weight to send them at the bottom of the list. Now, they are at the top. Do I need to set weight for all other posts?

this commit (https://github.com/spf13/hugo/commit/4b4ab4755339a8c1d034be1f75b323d585dac1df) breaks expected sorting.

{{ range .Data.Pages.ByWeight.Reverse }}
output: 0 0 20161200 20161000 450 100 50 10

output expected: 20161200 20161000 450 100 50 10 0 0

Please don't comment on closed bugs and expect someone to pick up on it.

Was this page helpful?
0 / 5 - 0 ratings