{{- $url := split .Permalink "/" -}} {{- $page_version := index $url (sub (len $url) 4) -}} {{- $group_slug := index $url (sub (len $url) 3) -}} {{- $page_slug := index $url (sub (len $url) 2) -}} {{- $versions_link := "" -}} {{- if and (eq .Layout "docs") (eq $page_version .Site.Params.docs_version) -}} {{- $versions_link = printf "%s/%s/" $group_slug $page_slug -}} {{- else if (eq .Layout "single") -}} {{- $versions_link = printf "%s/" $page_slug -}} {{- end -}} {{- $added_in_51 := eq (string .Page.Params.added.version) "5.1" -}} {{- $added_in_52 := eq (string .Page.Params.added.version) "5.2" -}} {{- $added_in_53 := eq (string .Page.Params.added.version) "5.3" -}}