summaryrefslogtreecommitdiffstats
path: root/hugofs
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-01-30 22:26:55 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-01-31 10:06:04 +0100
commitbd66d30295e5454bb076d3108a89f6c3ad9bcde8 (patch)
treeeb243a8de3d9da8cb96049fb06fc4e7bdc6e55b7 /hugofs
parent7caa5b3e501b81ecf78554db287b7762200c2728 (diff)
Filter out duplicate content resource files
We do a slight normalisation of the content paths (lower case, replacing " " with "-") and remove andy language identifier before inserting them into the content tree. This means that, given that that the default content language is `en`: ``` index.md index.html Foo Bar.txt foo-bar.txt foo-bar.en.txt Foo-Bar.txt ``` The bundle above will be reduced to one content file with one resource (`foo-bar.txt`). Before this commit, what version of the `foo-bar.txt` you ended up with was undeterministic. No we pick the first determined by sort order. Note that the sort order is stable, but we recommend avoiding situations like the above. Closes #11946
Diffstat (limited to 'hugofs')
-rw-r--r--hugofs/component_fs.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/hugofs/component_fs.go b/hugofs/component_fs.go
index c55f15957..62d977ae8 100644
--- a/hugofs/component_fs.go
+++ b/hugofs/component_fs.go
@@ -147,13 +147,13 @@ func (f *componentFsDir) ReadDir(count int) ([]iofs.DirEntry, error) {
})
if f.fs.opts.Component == files.ComponentFolderContent {
- // Finally filter out any duplicate content files, e.g. page.md and page.html.
+ // 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() || !pi.IsContent()
+ keep := fim.IsDir()
if !keep {
baseLang := hstrings.Tuple{First: pi.Base(), Second: fim.Meta().Lang}