summaryrefslogtreecommitdiffstats
path: root/hugolib/content_map.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-28 10:27:39 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-06-29 10:14:19 +0200
commit7917961d59b0dc216e49f59dc0255f9b46534115 (patch)
treeee9a348c2555fdbbac8022ade50c5d440a81ae4e /hugolib/content_map.go
parent80ecb958951783eb03e23a81800102d0e33db6e1 (diff)
Misc permalinks adjustments
* Move config loading to the page package * Fix a lower bound panic for the `:sections` slice syntax. * Always return the `:title` * Add some permalinks integration tests * Also see issues below Fixes #9448 Fixes #11184 See #8523
Diffstat (limited to 'hugolib/content_map.go')
-rw-r--r--hugolib/content_map.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/hugolib/content_map.go b/hugolib/content_map.go
index a7f344004..9abf0d5b0 100644
--- a/hugolib/content_map.go
+++ b/hugolib/content_map.go
@@ -680,7 +680,14 @@ func (m *contentMap) splitKey(k string) []string {
return nil
}
- return strings.Split(k, "/")[1:]
+ parts := strings.Split(k, "/")[1:]
+ if len(parts) == 0 {
+ return nil
+ }
+ if parts[len(parts)-1] == "" {
+ parts = parts[:len(parts)-1]
+ }
+ return parts
}
func (m *contentMap) testDump() string {