{{- define "main" -}}

<h1>{{ .Title | markdownify }}</h1>

{{ .Content }}

{{- $page_params := .Params }}
{{- $translated_badges := index $.Site.Data.badges .Lang }}

<div class="service-badges">
{{ range $translated_badges.badges.active_badges }}

  {{- $badge := index $translated_badges.badges.badges . }}
  {{- $status_name := default "none" (index $page_params.service_badges .) -}}
  {{- $status := index $translated_badges.status.status $status_name -}}

  <div class="badge-icon badge-status-{{ $status_name }}">
    {{ $svg := printf "static/static/img/badges/%s" $badge.icon }}
    {{ $svg  | readFile | safeHTML }}
  </div>
  
  <div class="badge-name">
    {{ title $badge.name }}<br>
    = {{ $status.name }}
  </div>
  
  
  <div class="badge-description">
    {{- $markdown := $badge.description | markdownify -}}

    {{ if not ( findRE "<[h|p][^>]*>" $markdown ) }}
        <p>{{ $markdown }}</p>
    {{ else }}
        {{ $markdown }}
    {{ end }}

  </div>

{{ end }}
</div>

{{ partial "status.html" . }}

{{- end -}}