1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

hugofs: Add includeFiles and excludeFiles to mount configuration

Fixes #9042
This commit is contained in:
Bjørn Erik Pedersen
2021-10-16 16:24:49 +02:00
parent 94a5bac5b2
commit 471ed91c60
15 changed files with 797 additions and 133 deletions

View File

@ -137,8 +137,9 @@ func (b *contentBuilder) buildDir() error {
if !b.dirMap.siteUsed {
// We don't need to build everything.
contentInclusionFilter = glob.NewFilenameFilterForInclusionFunc(func(filename string) bool {
filename = strings.TrimPrefix(filename, string(os.PathSeparator))
for _, cn := range contentTargetFilenames {
if strings.HasPrefix(cn, filename) {
if strings.Contains(cn, filename) {
return true
}
}
@ -205,7 +206,8 @@ func (b *contentBuilder) buildFile() error {
if !usesSite {
// We don't need to build everything.
contentInclusionFilter = glob.NewFilenameFilterForInclusionFunc(func(filename string) bool {
return strings.HasPrefix(contentPlaceholderAbsFilename, filename)
filename = strings.TrimPrefix(filename, string(os.PathSeparator))
return strings.Contains(contentPlaceholderAbsFilename, filename)
})
}