mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
Fixes #141: Wrong section in multi level structure
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Input interface {
|
type Input interface {
|
||||||
@@ -41,8 +42,11 @@ func (f *Filesystem) add(name string, reader io.Reader) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// section should be the first part of the path
|
||||||
dir, logical := path.Split(name)
|
dir, logical := path.Split(name)
|
||||||
_, section := path.Split(path.Dir(name))
|
parts := strings.Split(dir, "/")
|
||||||
|
section := parts[0]
|
||||||
|
|
||||||
if section == "." {
|
if section == "." {
|
||||||
section = ""
|
section = ""
|
||||||
}
|
}
|
||||||
@@ -54,6 +58,7 @@ func (f *Filesystem) add(name string, reader io.Reader) (err error) {
|
|||||||
Section: section,
|
Section: section,
|
||||||
Dir: dir,
|
Dir: dir,
|
||||||
})
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user