all repos — vite @ c720289599cf73858c8150484d1b3fdafcaa5595

a fast (this time, actually) and minimal static site generator

config.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
package main

import (
	"gopkg.in/yaml.v2"
	"io/ioutil"
)

type Config struct {
	Title       string            `yaml:"title"`
	Header      string            `yaml:"header"`
	SiteURL     string            `yaml:"siteurl"`
	Description string            `yaml:"description"`
	Author      map[string]string `yaml:"author"`
	Footer      string            `yaml:"footer"`
	Prebuild    []string          `yaml:"prebuild"`
	Postbuild   []string          `yaml:"postbuild"`
	RSSPrefixURL string			  `yaml:"rssprefixurl"`
}

func parseConfig() Config {
	var config Config
	cf, err := ioutil.ReadFile("config.yaml")
	if err != nil {
		printErr(err)
	}

	err = yaml.Unmarshal(cf, &config)
	if err != nil {
		printErr(err)
	}

	return config
}