Added Index Page

Christopher Vollick [2010-03-21 00:15]
Added Index Page

This page is meant to be the home page.
It's got a couple recent posts or something.
Filename
gitsite
diff --git a/gitsite b/gitsite
index e4d08ff..877fa26 100755
--- a/gitsite
+++ b/gitsite
@@ -6,6 +6,9 @@ destDir="$2"
 # This is the number of items to include in our feeds
 feedNum="10"

+# This is the number of items to include on the index page
+indexNum="2"
+
 # Make the destDir if it doesn't exist
 mkdir -p "$destDir"

@@ -41,6 +44,10 @@ mkdir -p "$tmpArticleTemplateDir"
 tmpAtom="$tmpDir/temp-atom"
 echo -n "" > "$tmpAtom"

+# Initialize the index temp file
+tmpIndex="$tempDir/temp-index"
+echo -n "" > "$tmpIndex"
+
 # 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 -r)"

@@ -95,11 +102,19 @@ for index in $(seq 1 $numArticles); do
 	if [ "$index" -le "$feedNum" ]; then
 		templates/atom-entry Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" >> "$tmpAtom"
 	fi
+
+	# If this article is within the first indexNum, run it through there.
+	if [ "$index" -le "$indexNum" ]; then
+		templates/index-article Content "|$tmpArticleDir/$title" Title "$title" NextTitle "$next" NextLink "$nextLink" PreviousTitle "$prev" PreviousLink "$prevLink" CreationDate "$published" ModificationDate "$modified" ID "$id" Self "articles/$encTitle" >> "$tmpIndex"
+	fi
 done

 # Now generate the atom feed
 templates/atom-feed Content "|$tmpAtom" > "$absDestDir/feed.atom"

+# And the index page
+templates/site Title "Home Page" Content "$(templates/index Content "|$tmpIndex")"  > "$absDestDir/index"
+
 rm -rf "$tmpDir"

 # Copy over the static content
ViewGit