commands: Create _default/baseof.html in "new theme"
authorAnthony Fok <foka@debian.org>
Mon, 11 Jun 2018 07:46:36 +0000 (01:46 -0600)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 11 Jun 2018 08:40:22 +0000 (10:40 +0200)
Thanks to @digitalcraftsman, @bep and @rdwatters for providing the
actual content of the default baseof.html file.

Fixes #3576

commands/new_theme.go

index e01790deef7878017ff48e1cfb7c68178520fb6d..3a3677c85a62eed63fcda4e11e25d830b56f8872 100644 (file)
@@ -80,6 +80,22 @@ func (n *newThemeCmd) newTheme(cmd *cobra.Command, args []string) error {
        touchFile(cfg.Fs.Source, createpath, "layouts", "_default", "list.html")
        touchFile(cfg.Fs.Source, createpath, "layouts", "_default", "single.html")
 
+       baseofDefault := []byte(`<html>
+    {{- partial "head.html" . -}}
+    <body>
+        {{- partial "header.html" . -}}
+        <div id="content">
+        {{- block "main" . }}{{- end }}
+        </div>
+        {{- partial "footer.html" . -}}
+    </body>
+</html>
+`)
+       err = helpers.WriteToDisk(filepath.Join(createpath, "layouts", "_default", "baseof.html"), bytes.NewReader(baseofDefault), cfg.Fs.Source)
+       if err != nil {
+               return err
+       }
+
        touchFile(cfg.Fs.Source, createpath, "layouts", "partials", "header.html")
        touchFile(cfg.Fs.Source, createpath, "layouts", "partials", "footer.html")