Reversed Sort Order.

Christopher Vollick [2010-03-20 19:57]
Reversed Sort Order.

Now the newest items are at the top of the internal article list.
I did this becauase I decided that most things would want it in this order.
Filename
gitsite
diff --git a/gitsite b/gitsite
index 4c99b57..026622d 100755
--- a/gitsite
+++ b/gitsite
@@ -35,7 +35,7 @@ tmpArticleTemplateDir="$tmpDir/articleTemplated"
 mkdir -p "$tmpArticleTemplateDir"

 # Get the list, in order of creation, of all articles
-articlesAndIds="$(ls articles/ | while read article; do echo "$(git log --follow --pretty=format:%at "articles/$article" | sed -n '$p')	$article"; done | sort)"
+articlesAndIds="$(ls articles/ | while read article; do echo "$(git log --follow --pretty=format:%at "articles/$article" | sed -n '$p')	$article"; done | sort -r)"

 ids="$(echo "$articlesAndIds" | cut -d '	' -f1)"
 articles="$(echo "$articlesAndIds" | cut -d '	' -f2)"
@@ -46,8 +46,8 @@ numArticles="$(echo "$articles" | wc -l)"
 for index in $(seq 1 $numArticles); do

 	# Find the surrounding articles
-	prev="$(echo "$articles" | sed -n "$(expr $index - 1)p")"
-	next="$(echo "$articles" | sed -n "$(expr $index + 1)p")"
+	prev="$(echo "$articles" | sed -n "$(expr $index + 1)p")"
+	next="$(echo "$articles" | sed -n "$(expr $index - 1)p")"

 	# And get the links to them
 	prevLink="$(echo "$prev" | ./encode_filename)"
ViewGit