-
Notifications
You must be signed in to change notification settings - Fork 0
Config
Regis Philibert edited this page Aug 27, 2021
·
7 revisions
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 optinal but highly recommaned. List of available files are as follow:
- styles
- scripts
- fonts
- media
- seo
# _huge/config/scripts.yaml
scripts:
- name: carousel
path: js/carousel/index.js
params:
title: Land of surprises!
slides: carousel/GetHomeSlides()
{{/* layouts/partials/carousel/GetHomeSlides.html
{{ $slides := slice }}
{{ with site.Home.Params.slides }}
{{ $slides = . }}
{{ end }}
{{ return $slides }}
# _huge/config/media.yaml
imgix:
disable: my-config-funcs/imgix_disable()
domain: my-config-funcs/imgix_domain()
{{/* layouts/partials/my-config-funcs/imgix_disable.html */}}
{{ return site.IsServer }}
{{/* layouts/partials/my-config-funcs/imgix_domain.html */}}
{{ $domain := "staging.imgix.net" }}
{{ if partial "huge/env/Is" "production" }}
{{ $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()
-
my-config-funcs/imgix_disable()
will be replaced by the value returned bylayouts/partials/my-config-funcs/imgix_disable.html
-
carousel/GetHomeSlides()
will be replaced by the value returned bylayouts/partials/carousel/GetHomeSlides.html
-
logic/ParsePosts.dev()
will be replaced by the value returned bylayouts/partials/logic/ParsePosts.dev
- 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.disable()
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!