package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io/ioutil"
|
|
)
|
|
|
|
//Post is the struct for each post of the blog
|
|
type Post struct {
|
|
Thumb string `json:"thumb"`
|
|
Md string `json:"md"`
|
|
}
|
|
|
|
//Config gets the config.json file into struct
|
|
type Config struct {
|
|
Title string `json:"title"`
|
|
IndexTemplate string `json:"indexTemplate"`
|
|
PostThumbTemplate string `json:"postThumbTemplate"`
|
|
Posts []Post `json:"posts"`
|
|
CopyRaw []string `json:"copyRaw"`
|
|
}
|
|
|
|
var config Config
|
|
|
|
func readConfig(path string) {
|
|
file, err := ioutil.ReadFile(path)
|
|
check(err)
|
|
content := string(file)
|
|
json.Unmarshal([]byte(content), &config)
|
|
}
|