I need to make changes based on if I’m running local or on a server. I want to know if a setting is set to something. How do I access all settings from a template ? Something along the lines of this…
{{ if eq .HUGO_uglyurls true}}
{{/* Run code to set my site for local use */}}
{{end}}
For now I have been using this as a workaround. Basically, I set in a make file params local to true or false. In the template I do this.
Thanks guys. I just wanted to make the site local when needed to add index.html where needed. That will work ‘IsServer’. I was reading the docs here and an example uses hugo --uglyurls but that does not seem work. I get Error: unknown flag: --uglyURLs. Should I just continue setting configurations from my make file like this?
local:
env HUGO_PARAMS='{"local":true}' HUGO_uglyurls=true \
hugo -D --verbose --baseURL="$(LOCAL_SITE)"
server:
env HUGO_PARAMS='{"local":false}' HUGO_baseURL="$SERVER_SITE" \
hugo -D --verbose server
Or are there flags I can use like --uglyURLs=true --relativeURLs=true etc… I did not see the --uglyURLs flag in the man page or help?