There was an error while loading. Please reload this page.
1 parent 94a6233 commit 5e6b269Copy full SHA for 5e6b269
commands/hugobuilder.go
@@ -464,7 +464,15 @@ func (c *hugoBuilder) copyStaticTo(sourceFs *filesystems.SourceFilesystem) (uint
464
infol.Logf("removing all files from destination that don't exist in static dirs")
465
466
syncer.DeleteFilter = func(f fsync.FileInfo) bool {
467
- return f.IsDir() && strings.HasPrefix(f.Name(), ".")
+ name := f.Name()
468
+
469
+ // Keep .gitignore and .gitattributes anywhere
470
+ if name == ".gitignore" || name == ".gitattributes" {
471
+ return true
472
+ }
473
474
+ // Keep Hugo's original dot-directory behavior
475
+ return f.IsDir() && strings.HasPrefix(name, ".")
476
}
477
478
start := time.Now()
0 commit comments