{{/* get the file name associated with the page */}} {{- $file := print .Page.File.Dir -}} {{/* split by the seperator ("/") */}} {{- $parts := split $file "/" -}} {{/* this will grab the first part which is the section (aka product), e.g. `os` */}} {{- $url_section := index $parts 0 -}} {{/* grab the current version from the Hugo data file */}} {{- $versions := index $.Site.Data.versions.current $url_section -}} {{/* create the version string (e.g. `1.14.x`) */}} {{- $latest := print $versions.major "." $versions.minor ".x" -}} {{/* get the language (which is not part of the file name) */}} {{- $language := .Page.Language.Lang -}}