I have a use case where I need to use the title of a post in a aria-labelledby
attribute. The issue is I need a valid id
to pull from which does not allow for white space. I’d like to use the output of the {{ .Title }}
so I tried this:
<li>
<a href="{{ .Permalink }}" aria-labelledby="{{ trim .Title " " }}">{{ $firstLetter }}<span>{{ $secondLetter }}</span></a>
</li>
<li id="{{ trim .Title " " }}">{{ .Title }}</li>
But it doesn’t work. After looking at the documentation, I’m at a loss. It like I need the opposite of the humanize
function…