Hi guys:
My site params is:
params:
socials:
GitHub: https://github.com/yourname || fab fa-github
E-Mail: mailto:yourname@gmail.com || fa fa-envelope
And output in sidebar page like this:
{{ range $name,$val := $SP.socials }}
{{ $href := "" }}
{{ $icon := "" }}
{{ range $i, $v := split $val "||" }}
{{ if eq $i 0 }}
{{ $href = $v }}
{{ else }}
{{ $icon = $v }}
{{ end }}
{{ end }}
<span class="links-of-author-item">
<a href="{{ $href }}" title="{{ $name }} " rel="noopener" target="_blank"><i class="{{ $icon }}"></i>{{ $name }}</a>
</span>
{{ end }}
I was found the same required in this forum which link is https://discourse.gohugo.io/t/ordering-site-params-by-source-order/366/2 , but seems not good method to resolved it.
Does anyone had new idea, thanks.
By the way, is there had a function get array value by index not use range?