如何从GO模板中的HREF中删除文件扩展名?
我是Go-Templates的新手,我想知道是否有一种方法可以删除模板中的文件扩展名。
{{- range $val := .Filelist}}
<li>
<a href="{{$val}}">
{{ $val }}
</a>
</li>
{{- end }}
如您所见,我宣布了我的filelist并宣布了HREF。例如,结果是:
- 1。图2.
- 绘图,
但我只希望显示1或2。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论