为了账号安全,请及时绑定邮箱和手机立即绑定

转到模板: 如何打印数组[]字符串以<脚本类型=“application/ld+json”>

转到模板: 如何打印数组[]字符串以<脚本类型=“application/ld+json”>

Go
ibeautiful 2022-10-04 17:12:52
[![在此输入图像描述][1]][1]我有1个数组字符串包含许多图像URL,如何将其显示在应用程序中/ ld + json请帮我解决这个问题!谢谢大家!这是可变类型切片包含许多图像网址images := []string{            "abc.com/1.jpg",            "abc.com/2.jpg",            "abc.com/3.jpg",            "...",        }这是用 html 格式的脚本<script type="application/ld+json">{    "@context": "https://schema.org",    "@type": "NewsArticle",    "mainEntityOfPage": {        "@type": "WebPage",        "@id": "{{$currentUrl}}"    },    "headline": "{{$postTile}}",    "image": [        "*i want show imageUrl at here*",        "*i want show imageUrl at here*",        "*i want show imageUrl at here*",    ]}
查看完整描述

1 回答

?
LEATH

TA贡献1936条经验 获得超6个赞

只需在图像上划清界限,如@mkopriva评论中所述:

{{range .ImageSlice}}{{.}}{{end}}

试试这个操场

参考模板文档


查看完整回答
反对 回复 2022-10-04
  • 1 回答
  • 0 关注
  • 52 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信