shithub: hugo

Download patch

ref: 0f438d185272f9c14b8aa64dd0cb2d0cef260361
parent: bea7b2e202dc3d60a59711be0e8c7b578ac64fed
author: Andy Williams <[email protected]>
date: Wed Oct 14 10:12:59 EDT 2015

Create minimal default.md in archetype file

fixes #315
To fix the cast error, create a minimal default.md in the archetype
folder.

--- a/commands/new.go
+++ b/commands/new.go
@@ -163,8 +163,15 @@
 	touchFile(createpath, "layouts", "partials", "footer.html")
 
 	mkdir(createpath, "archetypes")
-	touchFile(createpath, "archetypes", "default.md")
 
+	archDefault := []byte("+++\n+++\n")
+
+	err := helpers.WriteToDisk(filepath.Join(createpath, "archetypes", "default.md"), bytes.NewReader(archDefault), hugofs.SourceFs)
+	if err != nil {
+
+		jww.FATAL.Fatalln(err)
+	}
+
 	mkdir(createpath, "static", "js")
 	mkdir(createpath, "static", "css")
 
@@ -190,7 +197,7 @@
 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 `)
 
-	err := helpers.WriteToDisk(filepath.Join(createpath, "LICENSE.md"), bytes.NewReader(by), hugofs.SourceFs)
+	err = helpers.WriteToDisk(filepath.Join(createpath, "LICENSE.md"), bytes.NewReader(by), hugofs.SourceFs)
 	if err != nil {
 		jww.FATAL.Fatalln(err)
 	}