{{- $name := .Get 0 -}}
{{- $metadata := index site.Data.builtin_metadata $name }}

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

<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>