commit df0523ff7f645b9eaeedea40998bf68715dab959
parent 5003f7f7af21db953776c0cd7d672e957a1cc77e
Author: spf13 <steve.francia@gmail.com>
Date: Sat, 26 Oct 2013 00:20:48 -0400
Flipping around weight order. higher weight at the bottom. use negative to pin to top.
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hugolib/index.go b/hugolib/index.go
@@ -32,7 +32,7 @@ func (p IndexedPages) Less(i, j int) bool {
if p[i].Weight == p[j].Weight {
return p[i].Page.Date.Unix() > p[j].Page.Date.Unix()
} else {
- return p[i].Weight > p[j].Weight
+ return p[i].Weight < p[j].Weight
}
}
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
@@ -372,8 +372,8 @@ func TestOrderedPages(t *testing.T) {
t.Fatalf("Unable to build site metadata: %s", err)
}
- if s.Sections["sect"][0].Weight != 6 || s.Sections["sect"][3].Weight != 2 {
- t.Errorf("Pages in unexpected order. First should be '%s', got '%s'", 6, s.Sections["sect"][0].Weight)
+ if s.Sections["sect"][0].Weight != 2 || s.Sections["sect"][3].Weight != 6 {
+ t.Errorf("Pages in unexpected order. First should be '%s', got '%s'", 2, s.Sections["sect"][0].Weight)
}
if s.Sections["sect"][1].Page.Title != "Three" || s.Sections["sect"][2].Page.Title != "Four" {
@@ -437,12 +437,12 @@ func TestWeightedIndexes(t *testing.T) {
t.Fatalf("Unable to build site metadata: %s", err)
}
- if s.Indexes["tags"]["a"][0].Page.Title != "bar" {
- t.Errorf("Pages in unexpected order, 'bar' expected first, got '%v'", s.Indexes["tags"]["a"][0].Page.Title)
+ if s.Indexes["tags"]["a"][0].Page.Title != "foo" {
+ t.Errorf("Pages in unexpected order, 'foo' expected first, got '%v'", s.Indexes["tags"]["a"][0].Page.Title)
}
- if s.Indexes["categories"]["d"][0].Page.Title != "foo" {
- t.Errorf("Pages in unexpected order, 'foo' expected first, got '%v'", s.Indexes["categories"]["d"][0].Page.Title)
+ if s.Indexes["categories"]["d"][0].Page.Title != "bar" {
+ t.Errorf("Pages in unexpected order, 'bar' expected first, got '%v'", s.Indexes["categories"]["d"][0].Page.Title)
}
if s.Indexes["categories"]["e"][0].Page.Title != "bza" {