~srivathsan/blaze

60f3b5dcda727ab315eddb5b9aaa6869a32a0812 — Srivathsan Murali 3 years ago afeaa75
remove CreatePage function
1 files changed, 0 insertions(+), 22 deletions(-)

M builder/page.go
M builder/page.go => builder/page.go +0 -22
@@ 29,28 29,6 @@ type Page struct {
	relativePath string
}

func CreatePage(path string, config *config.BlazeConfig) error {
	targetPath := filepath.Join(config.ContentDir(), path)

	baseDir := filepath.Dir(targetPath)
	if err := os.MkdirAll(baseDir, 0754); err != nil {
		return err
	}

	data := fmt.Sprintf(
		"---\ntitle: Title\ndraft: true\ntemplate: %s\ndate: %s\n---\n# Title",
		config.DefaultTemplate,
		time.Now().Format("2006-01-02"),
	)

	if err := ioutil.WriteFile(targetPath, []byte(data), 0644); err != nil {
		return err
	}
	fmt.Println("Created Page", targetPath)

	return nil
}

func changeExtension(_path, new_ext string) string {
	var extension = filepath.Ext(_path)
	var name = _path[0 : len(_path)-len(extension)]