Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-11-01 22:30:34 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-11-01 23:06:39 +0300
commit30aba7fb099678363b0a4828936ed28e740e00e2 (patch)
tree59e803a1a240e81799285e356e4127463fc7b0c0 /source
parent04a3b45db4cd28b4821b5c98cd67dfbf1d098957 (diff)
source: Make ContentBaseName() return the directory for branch bundles
Fixes #9112
Diffstat (limited to 'source')
-rw-r--r--source/fileInfo.go9
1 files changed, 4 insertions, 5 deletions
diff --git a/source/fileInfo.go b/source/fileInfo.go
index cef44f8ca..606b8b025 100644
--- a/source/fileInfo.go
+++ b/source/fileInfo.go
@@ -120,7 +120,7 @@ type FileInfo struct {
translationBaseName string
contentBaseName string
section string
- isLeafBundle bool
+ classifier files.ContentClass
uniqueID string
@@ -199,12 +199,12 @@ func (fi *FileInfo) init() {
relDir := strings.Trim(fi.relDir, helpers.FilePathSeparator)
parts := strings.Split(relDir, helpers.FilePathSeparator)
var section string
- if (!fi.isLeafBundle && len(parts) == 1) || len(parts) > 1 {
+ if (fi.classifier != files.ContentClassLeaf && len(parts) == 1) || len(parts) > 1 {
section = parts[0]
}
fi.section = section
- if fi.isLeafBundle && len(parts) > 0 {
+ if fi.classifier.IsBundle() && len(parts) > 0 {
fi.contentBaseName = parts[len(parts)-1]
} else {
fi.contentBaseName = fi.translationBaseName
@@ -238,7 +238,6 @@ func (sp *SourceSpec) NewFileInfo(fi hugofs.FileMetaInfo) (*FileInfo, error) {
filename := m.Filename
relPath := m.Path
- isLeafBundle := m.Classifier == files.ContentClassLeaf
if relPath == "" {
return nil, errors.Errorf("no Path provided by %v (%T)", m, m.Fs)
@@ -287,7 +286,7 @@ func (sp *SourceSpec) NewFileInfo(fi hugofs.FileMetaInfo) (*FileInfo, error) {
name: name,
baseName: baseName, // BaseFileName()
translationBaseName: translationBaseName,
- isLeafBundle: isLeafBundle,
+ classifier: m.Classifier,
}
return f, nil