mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Allow themes to define output formats, media types and params
This allows a `config.toml` (or `yaml`, ´yml`, or `json`) in the theme to set: 1) `params` (but cannot override params in project. Will also get its own "namespace", i.e. `{{ .Site.Params.mytheme.my_param }}` will be the same as `{{ .Site.Params.my_param }}` providing that the main project does not define a param with that key. 2) `menu` -- but cannot redefine/add menus in the project. Must create its own menus with its own identifiers. 3) `languages` -- only `params` and `menu`. Same rules as above. 4) **new** `outputFormats` 5) **new** `mediaTypes` This should help with the "theme portability" issue and people having to copy and paste lots of setting into their projects. Fixes #4490
This commit is contained in:
@@ -154,11 +154,16 @@ func ReplaceExtension(path string, newExt string) string {
|
||||
// AbsPathify creates an absolute path if given a relative path. If already
|
||||
// absolute, the path is just cleaned.
|
||||
func (p *PathSpec) AbsPathify(inPath string) string {
|
||||
return AbsPathify(p.workingDir, inPath)
|
||||
}
|
||||
|
||||
// AbsPathify creates an absolute path if given a working dir and arelative path.
|
||||
// If already absolute, the path is just cleaned.
|
||||
func AbsPathify(workingDir, inPath string) string {
|
||||
if filepath.IsAbs(inPath) {
|
||||
return filepath.Clean(inPath)
|
||||
}
|
||||
|
||||
return filepath.Join(p.workingDir, inPath)
|
||||
return filepath.Join(workingDir, inPath)
|
||||
}
|
||||
|
||||
// GetLayoutDirPath returns the absolute path to the layout file dir
|
||||
|
Reference in New Issue
Block a user