{{- $basePath := (urls.Parse .Site.BaseURL).Path -}}
{{- $pagePath := strings.TrimPrefix $basePath .RelPermalink -}}
{{- if eq $pagePath "" -}}
{{- $pagePath = "/" -}}
{{- else if not (hasPrefix $pagePath "/") -}}
{{- $pagePath = printf "/%s" $pagePath -}}
{{- end -}}