mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
Fixes #141: Wrong section in multi level structure
This commit is contained in:
parent
6da23f7449
commit
de670ced86
1 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Input interface {
|
||||
|
@ -41,8 +42,11 @@ func (f *Filesystem) add(name string, reader io.Reader) (err error) {
|
|||
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 @@ func (f *Filesystem) add(name string, reader io.Reader) (err error) {
|
|||
Section: section,
|
||||
Dir: dir,
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue