mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Move the duplicate page/resource filter
Move the removal of duplicate content and resource files after we have determined if we're inside a leaf bundle or not. Note that these would eventually have been filtered out as duplicates when inserting them into the document store, but doing it here will preserve a consistent ordering. Fixes #12013
This commit is contained in:
@@ -21,7 +21,6 @@ import (
|
||||
"sort"
|
||||
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/common/hstrings"
|
||||
"github.com/gohugoio/hugo/common/paths"
|
||||
"github.com/gohugoio/hugo/hugofs/files"
|
||||
"github.com/spf13/afero"
|
||||
@@ -150,32 +149,6 @@ func (f *componentFsDir) ReadDir(count int) ([]iofs.DirEntry, error) {
|
||||
return fimi.Name() < fimj.Name()
|
||||
})
|
||||
|
||||
if f.fs.opts.Component == files.ComponentFolderContent {
|
||||
// Finally filter out any duplicate content or resource files, e.g. page.md and page.html.
|
||||
n := 0
|
||||
seen := map[hstrings.Tuple]bool{}
|
||||
for _, fi := range fis {
|
||||
fim := fi.(FileMetaInfo)
|
||||
pi := fim.Meta().PathInfo
|
||||
keep := fim.IsDir()
|
||||
|
||||
if !keep {
|
||||
baseLang := hstrings.Tuple{First: pi.Base(), Second: fim.Meta().Lang}
|
||||
if !seen[baseLang] {
|
||||
keep = true
|
||||
seen[baseLang] = true
|
||||
}
|
||||
}
|
||||
|
||||
if keep {
|
||||
fis[n] = fi
|
||||
n++
|
||||
}
|
||||
}
|
||||
|
||||
fis = fis[:n]
|
||||
}
|
||||
|
||||
return fis, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user