-
Notifications
You must be signed in to change notification settings - Fork 0
Config
HUGE takes its configuration settings through stand alone files of either yaml
, toml
or json
language located in the _huge/config/
directory at the root of the Hugo project.
Settings are optional but highly recommanded. List of available files are as follow:
- styles
- scripts
- fonts
- media
- seo
Slide data will be dynamically generated by a Hugo returning partial.
# _huge/config/scripts.yaml
scripts:
- path: js/carousel/index.js
params:
slides: carousel/GetHomeSlides()
{{/* layouts/partials/carousel/GetHomeSlides.html
{{ $slides := slice }}
{{ with site.Home.Params.slides }}
{{ $slides = . }}
{{ end }}
{{ return $slides }}
imgix domain will be dynamically generated by a Hugo returning partial which tests the environment.
# _huge/config/media.yaml
imgix:
domain: functions/GetImgixDomain()
{{/* layouts/partials/functions/GetImgixDomain.html */}}
{{ $domain := "staging.imgix.net" }}
{{ if partial "huge/env/IsProduction" . }}
{{ $domain = "live.imgix.net" }}
{{ end }}
{{ return $domain }}
User can use the value returned by a function to populate any key from the HUGE Config files!
To do so, one must use a string starting with the path to the function relative to the partials directory and append ()
key: path_to_partial()
-
carousel/GetHomeSlides()
will be replaced by the value returned bylayouts/partials/carousel/GetHomeSlides.html
-
my-config-funcs/imgix_domain()
will be replaced by the value returned bylayouts/partials/my-config-funcs/imgix_domain.html
- Extension is required only if not
HTML
as Hugo partial API always falls back on.html
when extension is omitted. - Currently
.
other than extension delimiters are not accepted in configuration functions filenames:my-config-funcs/imgix.domain()
will fail the build. - If no partial matching the path is found, HUGE will break the build with a message pointing to the not found partial.
For a partial located at /layouts/partials/logic/GetThings.html
filepath | ok/no | reference | ok/no |
---|---|---|---|
/layouts/partials/logic/GetThings.html |
✅ | logic/GetThings() |
✅ |
/layouts/partials/logic/GetThings.html |
✅ | logic/GetThings.html() |
✅ |
/layouts/partials/logic/GetThings.html |
✅ | layouts/logic/GetThings() |
🚫 |
/layouts/partials/logic/GetThings.dev |
✅ | logic/GetThings() |
🚫 |
/layouts/partials/logic/GetThings.dev |
✅ | logic/GetThings.dev() |
✅ |
/layouts/partials/logic/imgix.media.html |
🚫 | logic/imgix.media() |
🚫 |
This is a HUGE WIP right now! Stay tune for more info as we push it to Alpha!