shithub: hugo

Download patch

ref: de670ced86e6df76278a19f19068bbeb46cc5d2f
parent: 6da23f7449366e7699e406adb3334e71ffd1e70e
author: Ruben <[email protected]>
date: Thu Nov 28 10:27:09 EST 2013

Fixes #141: Wrong section in multi level structure

--- a/source/filesystem.go
+++ b/source/filesystem.go
@@ -6,6 +6,7 @@
 	"os"
 	"path"
 	"path/filepath"
+	"strings"
 )
 
 type Input interface {
@@ -41,8 +42,11 @@
 		return err
 	}
 
+	// section should be the first part of the path
 	dir, logical := path.Split(name)
-	_, section := path.Split(path.Dir(name))
+	parts := strings.Split(dir, "/")
+	section := parts[0]
+
 	if section == "." {
 		section = ""
 	}
@@ -54,6 +58,7 @@
 		Section:     section,
 		Dir:         dir,
 	})
+
 	return
 }