mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-13 06:34:54 -04:00
Simplify ExtractRootPaths
This commit is contained in:
parent
c3931ef748
commit
b00771ca14
@ -458,13 +458,11 @@ func ExtractRootPaths(paths []string) []string {
|
|||||||
r := make([]string, len(paths))
|
r := make([]string, len(paths))
|
||||||
for i, p := range paths {
|
for i, p := range paths {
|
||||||
root := filepath.ToSlash(p)
|
root := filepath.ToSlash(p)
|
||||||
if strings.Contains(root, "/") {
|
sections := strings.Split(root, "/")
|
||||||
sections := strings.Split(root, "/")
|
for _, section := range sections {
|
||||||
for _, section := range sections {
|
if section != "" {
|
||||||
if section != "" {
|
root = section
|
||||||
root = section
|
break
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r[i] = root
|
r[i] = root
|
||||||
|
Loading…
x
Reference in New Issue
Block a user