Solved as follows
{{ $path := "" }}
{{ with .File }}
{{ $path = .Path }}
{{ else }}
{{ $path = .Path }}
{{ end }}
{{ path.Base (path.Split $path).Dir }}
Solved as follows
{{ $path := "" }}
{{ with .File }}
{{ $path = .Path }}
{{ else }}
{{ $path = .Path }}
{{ end }}
{{ path.Base (path.Split $path).Dir }}