File tree Expand file tree Collapse file tree 4 files changed +25
-34
lines changed
Expand file tree Collapse file tree 4 files changed +25
-34
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ params:
142142
143143 editURL :
144144 enable : true
145- where : " single " # single | toc
145+ location : " toc " # single | toc
146146 base : " https://github.com/imfing/hextra/edit/main/exampleSite/content"
147147
148148 blog :
Original file line number Diff line number Diff line change 1+ {{- $editThisPage := (T "editThisPage") | default "Edit this page"}}
2+ {{- $linkClass := "mb-4 block text-xs text-gray-500 ltr:text-right rtl:text-left dark:text-gray-400" -}}
3+ {{- if and (site.Params.editURL.enable) (eq site.Params.editURL.location .source) -}}
4+ {{- $editURL := site.Params.editURL.base | default "" -}}
5+ {{- with .Params.editURL -}}
6+ {{/* if `editURL` is set in the front matter */}}
7+ {{- $editURL = . -}}
8+ {{- else -}}
9+ {{- with .File -}}
10+ {{/* `.FileInfo.Meta.SourceRoot` is a Hugo internal field, e.g. `/path/to/repo/content/en/` */}}
11+ {{- $sourceDir := replace (strings.TrimPrefix .FileInfo.Meta.BaseDir .FileInfo.Meta.SourceRoot) "\\" "/" -}}
12+ {{- $sourceDir = strings.TrimPrefix "/content" $sourceDir -}}
13+ {{- $path := replace .Path "\\" "/" -}}
14+ {{- $editURL = urls.JoinPath $editURL $sourceDir $path -}}
15+ {{- end -}}
16+ {{- end -}}
17+ {{- if eq site.Params.editURL.location "toc" -}}
18+ {{- $linkClass = "hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50" -}}
19+ {{- end -}}
20+ < a class ="{{ $linkClass }} " href ="{{ $editURL }} " target ="_blank " rel ="noreferer "> {{ $editThisPage }}</ a >
21+ {{- end -}}
Original file line number Diff line number Diff line change 22{{- $editThisPage := (T "editThisPage") | default "Edit this page"}}
33
44{{- if site.Params.displayUpdatedDate -}}
5- < div class ="hx-mt-12 hx-mb-8 hx-block hx-text-xs hx-text-gray-500 ltr:hx-text-right rtl:hx-text-left dark:hx-text-gray-400 ">
6- {{- if and (site.Params.editURL.enable) (eq site.Params.editURL.where "single") -}}
7- {{- $editURL := site.Params.editURL.base | default "" -}}
8- {{- with .Params.editURL -}}
9- {{/* if `editURL` is set in the front matter */}}
10- {{- $editURL = . -}}
11- {{- else -}}
12- {{- with .File -}}
13- {{/* `.FileInfo.Meta.SourceRoot` is a Hugo internal field, e.g. `/path/to/repo/content/en/` */}}
14- {{- $sourceDir := replace (strings.TrimPrefix .FileInfo.Meta.BaseDir .FileInfo.Meta.SourceRoot) "\\" "/" -}}
15- {{- $sourceDir = strings.TrimPrefix "/content" $sourceDir -}}
16- {{- $path := replace .Path "\\" "/" -}}
17- {{- $editURL = urls.JoinPath $editURL $sourceDir $path -}}
18- {{- end -}}
19- {{- end -}}
20- < a class ="mb-4 block text-xs text-gray-500 ltr:text-right rtl:text-left dark:text-gray-400 " href ="{{ $editURL }} " target ="_blank " rel ="noreferer "> {{ $editThisPage }}</ a >
21- {{- end -}}
5+ < div class ="hx-mt-12 hx-mb-8 hx-block hx-text-xs hx-text-gray-500 ltr:hx-text-right rtl:hx-text-left dark:hx-text-gray-400 ">
6+ {{ partial "components/edit-url.html" (dict "source" "single") }}
227 {{- with .Lastmod -}}
238 {{ $datetime := (time.Format "2006-01-02T15:04:05.000Z" .) }}
249 < div class ="hx-mt-4 "> {{ $lastUpdated }} < time datetime ="{{ $datetime }} "> {{ partial "utils/format-date" . }}</ time > </ div >
Original file line number Diff line number Diff line change 2424
2525 {{/* TOC bottom part */}}
2626 < div class ="{{ $borderClass }} hx-sticky hx-bottom-0 hx-flex hx-flex-col hx-items-start hx-gap-2 hx-pb-8 dark:hx-border-neutral-800 contrast-more:hx-border-t contrast-more:hx-border-neutral-400 contrast-more:hx-shadow-none contrast-more:dark:hx-border-neutral-400 ">
27- {{- if and (site.Params.editURL.enable) (eq site.Params.editURL.where "toc") -}}
28- {{- $editURL := site.Params.editURL.base | default "" -}}
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 -}}
41- < a class ="hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50 " href ="{{ $editURL }} " target ="_blank " rel ="noreferer "> {{ $editThisPage }}</ a >
42- {{- end -}}
27+ {{ partial "components/edit-url.html" (dict "source" "toc") }}
4328 {{/* Scroll To Top */}}
4429 < button aria-hidden ="true " id ="backToTop " onClick ="scrollUp(); " class ="hx-transition-all hx-duration-75 hx-opacity-0 hx-text-xs hx-font-medium hx-text-gray-500 hover:hx-text-gray-900 dark:hx-text-gray-400 dark:hover:hx-text-gray-100 contrast-more:hx-text-gray-800 contrast-more:dark:hx-text-gray-50 ">
4530 < span >
You can’t perform that action at this time.
0 commit comments