You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
926 B

6 years ago
6 years ago
6 years ago
4 years ago
6 years ago
6 years ago
6 years ago
6 years ago
4 years ago
6 years ago
6 years ago
  1. package main
  2. import (
  3. "encoding/json"
  4. "io/ioutil"
  5. )
  6. //Post is the struct for each post of the blog
  7. type Post struct {
  8. Thumb string `json:"thumb"`
  9. Md string `json:"md"`
  10. MetaImg string `json:"metaimg"`
  11. MetaDescr string `json:"metadescr"`
  12. }
  13. //Config gets the config.json file into struct
  14. type Config struct {
  15. Title string `json:"title"`
  16. MetaImg string `json:"metaimg"`
  17. MetaDescr string `json:"metadescr"`
  18. RelativePath string `json:"relativePath"`
  19. AbsoluteUrl string `json:"absoluteUrl"`
  20. IndexTemplate string `json:"indexTemplate"`
  21. PostThumbTemplate string `json:"postThumbTemplate"`
  22. Posts []Post `json:"posts"`
  23. CopyRaw []string `json:"copyRaw"`
  24. }
  25. var config Config
  26. func readConfig(path string) {
  27. file, err := ioutil.ReadFile(path)
  28. check(err)
  29. content := string(file)
  30. json.Unmarshal([]byte(content), &config)
  31. }