From 0f438d185272f9c14b8aa64dd0cb2d0cef260361 Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Wed, 14 Oct 2015 14:12:59 -0400 Subject: [PATCH] Create minimal default.md in archetype file fixes #315 To fix the cast error, create a minimal default.md in the archetype folder. --- commands/new.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/commands/new.go b/commands/new.go index 9d1691592..ed0b98499 100644 --- a/commands/new.go +++ b/commands/new.go @@ -163,7 +163,14 @@ func NewTheme(cmd *cobra.Command, args []string) { 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 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 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) }