{{- $name := .Get 0 -}}
{{- $version := index (split $.Page.File.Path "/") 1 -}}
{{- if (eq $version "latest") -}}
  {{- $version = index site.Data.releases 1 -}}
{{- end -}}

{{- $bimd := index (index site.Data.versions $version) "builtin_metadata" }}
{{- $metadata := index $bimd $name }}

<div class="tags">
    {{- if eq $metadata.introduced $version }}
        <span class="tag is-primary">New</span>
    {{- end }}
    {{- if and (ne $metadata.introduced "v0.17.0") (ne $metadata.introduced "edge") }}
    <a href="https://github.com/open-policy-agent/opa/releases/{{ $metadata.introduced }}" target="_blank">
        <span class="tag is-light">{{ $metadata.introduced }}</span>
    </a>
    {{- else if eq $metadata.introduced "edge" }}
    <span class="tag is-danger">{{ $metadata.introduced }}</span>
    {{- end }}
    {{- if index $metadata "wasm" -}}
        <span class="tag is-success">Wasm</span>
    {{- else -}}
        <span class="tag is-warning">SDK-dependent</span>
    {{- end -}}
</div>
