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

33 lines
569 B
Go

package static
import (
"git.blob42.xyz/blob42/hugobot/v3/config"
"encoding/json"
"os"
"path/filepath"
)
var data = map[string]interface{}{
"bolts": map[string]interface{}{
"names": BoltNames,
},
}
// Json Export Static Data
func HugoExportData() error {
dirPath := filepath.Join(config.HugoData())
for k, v := range data {
filePath := filepath.Join(dirPath, k+".json")
outputFile, err := os.Create(filePath)
defer outputFile.Close()
if err != nil {
return err
}
jsonEnc := json.NewEncoder(outputFile)
jsonEnc.Encode(v)
}
return nil
}