how to remove the file extension from an href in an go template?

Viewed 21

I am new to go-templates and i wonder if there's a way to remove the file extension within the template.

{{- range $val := .Filelist}}
            <li>
            <a href="{{$val}}">
            {{ $val }}
            </a>
            </li>
        {{- end }}

As you can see, i declared my filelist and declared the href. the outcome of this is for example:

  • 1.graph
  • 2.graph

But i only want the 1 or 2 to be shown.

0 Answers
Related