File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 26
26
< div class ="{{ $borderClass }} sticky bottom-0 flex flex-col items-start gap-2 pb-8 dark:border-neutral-800 contrast-more:border-t contrast-more:border-neutral-400 contrast-more:shadow-none contrast-more:dark:border-neutral-400 ">
27
27
{{- if site.Params.editURL.enable -}}
28
28
{{- $editURL := site.Params.editURL.base | default "" -}}
29
- {{- with .File -}}{{ $editURL = urls.JoinPath $editURL (replace .Path "\\" "/") }}{{- end -}}
30
- {{- with .Params.editURL -}}{{ $editURL = . }}{{- end -}}
29
+ {{- with .Params.editURL -}}
30
+ {{/* if `editURL` is set in the front matter */}}
31
+ {{- $editURL = . -}}
32
+ {{- else -}}
33
+ {{- with .File -}}
34
+ {{/* `.FileInfo.Meta.SourceRoot` is a Hugo internal field, e.g. `/path/to/repo/content/en/` */}}
35
+ {{- $sourceDir := replace (strings.TrimPrefix .FileInfo.Meta.BaseDir .FileInfo.Meta.SourceRoot) "\\" "/" -}}
36
+ {{- $sourceDir = strings.TrimPrefix "/content" $sourceDir -}}
37
+ {{- $path := replace .Path "\\" "/" -}}
38
+ {{- $editURL = urls.JoinPath $editURL $sourceDir $path -}}
39
+ {{- end -}}
40
+ {{- end -}}
31
41
< a class ="text-xs font-medium text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100 contrast-more:text-gray-800 contrast-more:dark:text-gray-50 " href ="{{ $editURL }} " target ="_blank " rel ="noreferer "> {{ $editThisPage }}</ a >
32
42
{{- end -}}
33
43
{{/* Scroll To Top */}}
You can’t perform that action at this time.
0 commit comments