{{- $shortref := .Get 0 -}} {{- $ref := (print "py/" $shortref) -}} {{- if in $ref "/_index.md" -}} {{- $path := (trim $ref "_index.md") -}} {{- with .Site.GetPage "section" (trim $path "/") -}} {{- .URL -}} {{- end -}} {{- else -}} {{- with .Site.GetPage "section" $ref }} {{- .URL -}} {{- else -}} {{- $ref | relref .Page -}} {{- end -}} {{- end -}}