.Params is returned as #ZgotmplZ

Hi everyone,

I have been looking around for a solution in vain, I have poked around with safeURL and safeHTML to no avail. Here is what the code looked like at the very beginning (might as well start fresh). There is only one image for featuredImage but the line break with the hyphen seems to be the default format when using Netlify CMS.

Markdown:

    title: "Title"
    featuredImage: 
        - 'https://mycdn.com/foo-bar/`

Template:

        {{range .Pages}}
            <a href={{.RelPermalink}}>
                <img src="{{.Params.featuredImage }}" alt="{{.Title}}"/>
                <h3>{{.Title}}</h3>
            </a>
        {{end}}

Result:

            <a href=/title/>
                <img src="#ZgotmplZ" alt="Title"/>
                <h3>Title</h3>
            </a>

I feel like this is going to be something stupid I am missing, if anyone knows better than me and is willing to help, I would be eternally grateful

Thank you

To me it seems that featuredimage is defined as a list in YAML. If I got that right, then you can access the first element from that list it like so:

<img src="{{ index .Params.featuredImage 0 }}" alt="{{.Title}}"/>
1 Like

That did it! Thank you so much :grinning:

I tried index earlier on and coupled it with safeHTML and safeURL and nothing was coming out of it

Glad I could help. :slight_smile: Good luck with your Hugo project!