shithub: hugo

Download patch

ref: df0523ff7f645b9eaeedea40998bf68715dab959
parent: 5003f7f7af21db953776c0cd7d672e957a1cc77e
author: spf13 <[email protected]>
date: Fri Oct 25 20:20:48 EDT 2013

Flipping around weight order. higher weight at the bottom. use negative to pin to top.

--- a/hugolib/index.go
+++ b/hugolib/index.go
@@ -32,7 +32,7 @@
 	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
 	}
 }
 
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -372,8 +372,8 @@
 		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 @@
 		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" {