1package ssg
2
3import (
4 "os"
5
6 "github.com/BurntSushi/toml"
7)
8
9type Config struct {
10 BaseURL string `toml:"base_url"`
11 Title string `toml:"title"`
12 Description string `toml:"description"`
13 Extra map[string]any `toml:"extra"`
14 SidebarOrder []string `toml:"sidebar_order"`
15}
16
17func LoadConfigFile(fn string, config *Config) error {
18 out, err := os.ReadFile(fn)
19 if err != nil {
20 return err
21 }
22 if err := toml.Unmarshal(out, config); err != nil {
23 return err
24 }
25 return nil
26}