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

[![在此输入图像描述][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*",

    ]

}


ibeautiful
浏览 53回答 1
1回答

LEATH

只需在图像上划清界限,如@mkopriva评论中所述:{{range .ImageSlice}}{{.}}{{end}}试试这个操场参考模板文档
打开App,查看更多内容
随时随地看视频慕课网APP