I’m confused and would be grateful for guidance on using Functions within a page, in this case, my About page. Here’s what I’m trying to do in my About page:
### Other Stuff
- Astrological Sign:
{{ $slice := slice "Aries" "Taurus" "Gemini" "Cancer" "Leo" "Virgo" "Libra" "Scorpio" "Sagittarius" "Capricorn" "Aquarius" "Pisces" }}
{{ $shuffled := shuffle $slice }}
{{ $random := index $shuffled 0 }}
{{ $random }}
- Big Five
- Extroversion: {{ math.Rand | mul 99 | math.Floor }}
- Emotional Stability: {{ math.Rand | mul 99 | math.Floor }}
- Agreeableness: {{ math.Rand | mul 99 | math.Floor }}
- Conscientiousness: {{ math.Rand | mul 99 | math.Floor }}
- Openness to Experience: {{ math.Rand | mul 99 | math.Floor }}
- Enneagram Number: {{ math.Rand | mul 9 | math.Floor }}
This renders in the HTML output as
<h3 id="other-stuff">Other Stuff</h3>
<ul>
<li>Astrological Sign:
{{ $slice := slice “Aries” “Taurus” “Gemini” “Cancer” “Leo” “Virgo” “Libra” “Scorpio” “Sagittarius” “Capricorn” “Aquarius” “Pisces” }}
{{ $shuffled := shuffle $slice }}
{{ $random := index $shuffled 0 }}
{{ $random }}</li>
<li>Big Five
<ul>
<li>Extroversion: {{ math.Rand | mul 99 | math.Floor }}</li>
<li>Emotional Stability: {{ math.Rand | mul 99 | math.Floor }}</li>
<li>Agreeableness: {{ math.Rand | mul 99 | math.Floor }}</li>
<li>Conscientiousness: {{ math.Rand | mul 99 | math.Floor }}</li>
<li>Openness to Experience: {{ math.Rand | mul 99 | math.Floor }}</li>
</ul>
</li>
<li>Enneagram Number: {{ math.Rand | mul 9 | math.Floor }}</li>
</ul>
Here are the relevant portions of my config.toml
enableInlineShortcodes = true
pygmentsCodeFences = true
pygmentsUseClasses = true
[markup.goldmark.renderer]
# Allow HTML in Markdown
unsafe = true
and my hugo env
hugo v0.134.2+extended darwin/arm64 BuildDate=2024-09-10T10:46:33Z VendorInfo=brew
GOOS="darwin"
GOARCH="arm64"
GOVERSION="go1.23.1"
github.com/sass/libsass="3.6.6"
github.com/webmproject/libwebp="v1.3.2"
I’m sure I’m missing something obvious in the docs. And yet I’ve combed through all the support documents that I can think to consult, with all the search terms I can come up with on my own, and I’m stumped.