aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/page__paths.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-05-31 09:40:58 +0200
committerBjørn Erik Pedersen <[email protected]>2019-06-09 16:55:08 +0200
commit3e6cb2cb77e16be5b6ddd4ae55d5fc6bfba2d226 (patch)
tree849651cfad7c4aed5c37691bc516845b6734bd94 /hugolib/page__paths.go
parent8d898ad6672e0ccb62c5a29b6fccab24d980f104 (diff)
downloadhugo-3e6cb2cb77e16be5b6ddd4ae55d5fc6bfba2d226.tar.gz
hugo-3e6cb2cb77e16be5b6ddd4ae55d5fc6bfba2d226.zip
hugolib: Fix bundle path when slug is set
Fixes #4870
Diffstat (limited to 'hugolib/page__paths.go')
-rw-r--r--hugolib/page__paths.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/hugolib/page__paths.go b/hugolib/page__paths.go
index adbdb4668..a9152f44a 100644
--- a/hugolib/page__paths.go
+++ b/hugolib/page__paths.go
@@ -15,6 +15,9 @@ package hugolib
import (
"net/url"
+ "strings"
+
+ "github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/resources/page"
)
@@ -95,8 +98,9 @@ func (l pagePaths) OutputFormats() page.OutputFormats {
func createTargetPathDescriptor(s *Site, p page.Page, pm *pageMeta) (page.TargetPathDescriptor, error) {
var (
- dir string
- baseName string
+ dir string
+ baseName string
+ contentBaseName string
)
d := s.Deps
@@ -104,6 +108,14 @@ func createTargetPathDescriptor(s *Site, p page.Page, pm *pageMeta) (page.Target
if !p.File().IsZero() {
dir = p.File().Dir()
baseName = p.File().TranslationBaseName()
+ contentBaseName = p.File().ContentBaseName()
+ }
+
+ if baseName != contentBaseName {
+ // See https://github.com/gohugoio/hugo/issues/4870
+ // A leaf bundle
+ dir = strings.TrimSuffix(dir, contentBaseName+helpers.FilePathSeparator)
+ baseName = contentBaseName
}
alwaysInSubDir := p.Kind() == kindSitemap