diff --git a/.gitignore b/.gitignore index df079f250..297d8d815 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ hugo.exe *.swp *.swo .DS_Store +*~ diff --git a/source/filesystem.go b/source/filesystem.go index cefe4a950..96853c8dd 100644 --- a/source/filesystem.go +++ b/source/filesystem.go @@ -117,5 +117,14 @@ func (f *Filesystem) avoid(filePath string) bool { } func ignoreDotFile(filePath string) bool { - return filepath.Base(filePath)[0] == '.' + base := filepath.Base(filePath) + if base[0] == '.' { + return true + } + + if base[len(base)-1] == '~' { + return true + } + + return false }