{{ $form := index .Site.Params.contact_forms 0 }} <form class="contact-form" action="{{ $form.submit_url }}" method="post"> <div class="form-grid"> {{ range $field := $form.fields }} <div class="form-group {{ if $field.class }}{{ $field.class }}{{ end }}"> <label for="{{ $field.name }}">{{ $field.name }}</label> {{ if eq $field.type "textarea" }} <textarea id="{{ $field.name }}" name="{{ $field.name }}" rows="5"{{ if $field.required }} required{{ end }}></textarea> {{ else }} <input type="{{ $field.type }}" placeholder="{{ $field.placeholder }}" id="{{ $field.name }}" name="{{ $field.name }}"{{ if $field.required }} required{{ end }}> {{ end }} </div> {{ end }} </div> <div class="form-group full-width"> <button class="button" type="submit">Submit</button> </div> </form>