mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Simplify ExtractRootPaths
This commit is contained in:
parent
c3931ef748
commit
b00771ca14
1 changed files with 5 additions and 7 deletions
|
@ -458,13 +458,11 @@ func ExtractRootPaths(paths []string) []string {
|
|||
r := make([]string, len(paths))
|
||||
for i, p := range paths {
|
||||
root := filepath.ToSlash(p)
|
||||
if strings.Contains(root, "/") {
|
||||
sections := strings.Split(root, "/")
|
||||
for _, section := range sections {
|
||||
if section != "" {
|
||||
root = section
|
||||
break
|
||||
}
|
||||
sections := strings.Split(root, "/")
|
||||
for _, section := range sections {
|
||||
if section != "" {
|
||||
root = section
|
||||
break
|
||||
}
|
||||
}
|
||||
r[i] = root
|
||||
|
|
Loading…
Reference in a new issue