Continuing the discussion from Get a substr of a string using length of words instead of characters (SOLVED):
How do I display just Cyndi
in my single.html file when Cyndi Lauper
is declared in the front matter? Note that I have multiple people in the section with names that vary in length so I need to find the first white space and remove it and everything thereafter to cater for everyone.
Can countwords
be used where you where you somehow then return only the first word? I’ve seen the string
and split
and substr
functions in the Hugo Docs but I’m not sure how to apply them. And the solution I found in the forum might/might-not work for my use case.
/content/people/cyndilauper.md
+++
Name = "Cyndi Lauper "
+++
/layouts/people/single.html
"follow Cyndi on Twitter'