Feat: add params.sourceURL and params.editURL for special pages

This commit is contained in:
Cell
2024-10-01 19:50:42 +08:00
parent 9e9bc9effd
commit e9edbba217
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.13-b44555d4" -}}
{{- .Scratch.Set "version" "v0.3.13-9e9bc9ef" -}}
{{- .Scratch.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}
+3 -2
View File
@@ -54,13 +54,14 @@
{{- end -}}
{{- if $params.LinkToSource | and $gitRepo -}}
{{- $link := replace $blobURL "{path}" $.File.Path -}}
{{- $sourceURL = add $link "?plain=1" -}}
{{- $sourceURL = $params.sourceURL | default (add $link "?plain=1") -}}
{{- $options := dict "Class" "link-to-source" "Destination" $sourceURL "Title" (T "single.viewSource") "Content" (T "single.viewSource") "externalIcon" false -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- if $params.LinkToEdit | and $gitRepo -}}
{{- $link := replace $editURL "{path}" $.File.Path -}}
{{- $options := dict "Class" "link-to-edit" "Destination" $link "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") "externalIcon" false -}}
{{- $editURL = $params.editURL | default $link -}}
{{- $options := dict "Class" "link-to-edit" "Destination" $editURL "Title" (T "single.editThisPage") "Content" (T "single.editThisPage") "externalIcon" false -}}
{{- $linkOptions = $linkOptions | append $options -}}
{{- end -}}
{{- if $params.LinkToReport | and $gitRepo -}}