Delimit map with filtered values

Hello,

I have got a map and I would like to filter the values and concat all values to a comma separated string. In YAML the map shows:

socialmedia:
    -
        name : "mail"
        url: "mailto:anybody@foo.com"
    -
        name : "github"
        url : "http://github.com/anybody
    -
        name : "facebook"
        url : "http://facebook.com/anybody"

I would like to get all url-values except the item with name == “mail” and build a string. The result should be a string like

"http://github.com/anybody", "http://facebook.com/anybody"

How can I do this? I have tried to do it with range and where, with this I can build the list, but the concatination of the url is incorrect, beause I get a comma at the end and with delimit I’m failing to exclude the element. So my current idea is

{{- range .Site.Params.socialmedia -}}
     {{- if not (eq .name "mail") -}}
          {{ .url }},
    {{- end -}}
{{- end -}}

I’m using Hugo 0.18, thanks for help

{{- range .Site.Params.socialmedia -}}
     {{- if ne .name "mail" -}}
         {{ .url }},
    {{- end -}}
{{- end -}}

and valid yaml

  socialmedia:
    -   name : "mail"
        url: "mailto:anybody@foo.com"
    -   name : "github"
        url : "http://github.com/anybody"
    -   name : "facebook"
        url : "http://facebook.com/anybody"

Your solution returns an equal result, but at the last entry in the list you will get a “,”

"http://github.com/anybody", "http://facebook.com/anybody", <- this comma is wrong

How can I build a list without the ending comma? I try delimit, but I cannot build a solution, so your solution has got the equal problem

{{- range $i, $kw := .Site.Params.socialmedia -}}{{ if gt $i 1}},{{ end }}
     {{- if ne .name "mail" -}}
         {{ .url }}
    {{- end -}}
{{- end -}}