{{- $editMap := partial "get-edit-url" . }} {{- if or .Site.Params.repoEditURL $editMap.repoEditURL }}
{{- $contentDir := cond .Site.IsMultiLingual .Site.Params.contentDir "/content/" }} {{- $filePath := ""}} {{- if $editMap.fileDir }} {{- $filePath = strings.TrimPrefix $editMap.fileDir .File.Path }} {{- else }} {{- $filePath = path.Join $contentDir .File.Path }} {{- end }} {{- $repoEditURL := cond (ne $editMap.repoEditURL "") $editMap.repoEditURL .Site.Params.repoEditURL }} {{- $path := path.Join $repoEditURL $filePath }} {{- $path = replace $path "http:/" "http://" 1 }} {{- $path = replace $path "https:/" "https://" 1 }} {{ i18n "editThisPage" }}
{{/* Deprecation warning(v1.0.0) starts */}} {{- else if .Site.Params.repoURL }} {{ warnf "Param 'repoURL' in params.yaml is deprecated and will be removed in Eureka v1.0.0. See https://www.wangchucheng.com/en/docs/hugo-eureka/customization/#params-config-file" }}
{{- $repoEditURL := path.Join .Site.Params.repoURL "/blob/master/" }} {{ $contentDir := cond .Site.IsMultiLingual .Site.Params.contentDir "/content/" }} {{ $path := path.Join $repoEditURL $contentDir .File.Path }} {{ $path = replace $path "http:/" "http://" 1 }} {{ $path = replace $path "https:/" "https://" 1 }} {{ i18n "editThisPage" }}
{{/* Deprecation warning(v1.0.0) ends */}} {{- end }} {{ define "partials/get-edit-url" }} {{ $repoEditURL := "" }} {{ $fileDir := "" }} {{ $bundles := partial "utils/get-bundles" . }} {{ range $bundles.Reverse }} {{ if .Params.repoEditURL }} {{ $repoEditURL = .Params.repoEditURL }} {{ $fileDir = .File.Dir }} {{ end }} {{ end }} {{ return (dict "repoEditURL" $repoEditURL "fileDir" $fileDir) }} {{ end }}