mirror of
https://github.com/danog/gojekyll.git
synced 2024-11-27 01:14:40 +01:00
60 lines
1.5 KiB
Go
60 lines
1.5 KiB
Go
package main
|
|
|
|
import yaml "gopkg.in/yaml.v2"
|
|
|
|
// SiteConfig is the Jekyll site configuration, typically read from _config.yml.
|
|
// See https://jekyllrb.com/docs/configuration/#default-configuration
|
|
type SiteConfig struct {
|
|
// Where things are:
|
|
Source string
|
|
Destination string
|
|
LayoutsDir string `yaml:"layouts_dir"`
|
|
Collections map[string]VariableMap
|
|
|
|
// Handling Reading
|
|
Include []string
|
|
Exclude []string
|
|
MarkdownExt string `yaml:"markdown_ext"`
|
|
|
|
// Outputting
|
|
Permalink string
|
|
}
|
|
|
|
func (s *Site) readConfigBytes(bytes []byte) error {
|
|
configVariables := VariableMap{}
|
|
if err := yaml.Unmarshal(bytes, &s.config); err != nil {
|
|
return err
|
|
}
|
|
if err := yaml.Unmarshal(bytes, &configVariables); err != nil {
|
|
return err
|
|
}
|
|
s.Variables = MergeVariableMaps(s.Variables, configVariables)
|
|
return nil
|
|
}
|
|
|
|
// From https://jekyllrb.com/docs/configuration/#default-configuration
|
|
const defaultSiteConfig = `
|
|
# Where things are
|
|
source: .
|
|
destination: ./_site
|
|
layouts_dir: _layouts
|
|
data_dir: _data
|
|
includes_dir: _includes
|
|
collections:
|
|
posts:
|
|
output: true
|
|
|
|
# Handling Reading
|
|
include: [".htaccess"]
|
|
exclude: ["Gemfile", "Gemfile.lock", "node_modules", "vendor/bundle/", "vendor/cache/", "vendor/gems/", "vendor/ruby/"]
|
|
keep_files: [".git", ".svn"]
|
|
encoding: "utf-8"
|
|
markdown_ext: "markdown,mkdown,mkdn,mkd,md"
|
|
strict_front_matter: false
|
|
|
|
# Outputting
|
|
permalink: date
|
|
paginate_path: /page:num
|
|
timezone: null
|
|
`
|