shithub: hugo

Download patch

ref: 3ba279c2e5cdb4cbed300c0054b68c334590b7bf
parent: 81695717e6dcb6c040cbaf54d179c2c49202a5d1
author: Anthony Fok <[email protected]>
date: Tue Mar 10 06:18:40 EDT 2015

Do not parse backup files with trailing '~' as templates

Fixes #964

--- a/tpl/template.go
+++ b/tpl/template.go
@@ -1230,6 +1230,10 @@
 	return filepath.Base(path)[0] == '.'
 }
 
+func isBackupFile(path string) bool {
+	return path[len(path)-1] == '~'
+}
+
 func (t *GoHtmlTemplate) loadTemplates(absPath string, prefix string) {
 	walker := func(path string, fi os.FileInfo, err error) error {
 		if err != nil {
@@ -1254,7 +1258,7 @@
 		}
 
 		if !fi.IsDir() {
-			if isDotFile(path) {
+			if isDotFile(path) || isBackupFile(path) {
 				return nil
 			}