mirror of
https://github.com/trwnh/hugo-theme-paradox.git
synced 2024-11-15 07:41:21 +00:00
46 lines
929 B
HTML
46 lines
929 B
HTML
|
{{ with .File }}
|
||
|
{{ $path := .Path }}
|
||
|
{{ $editLink := ""}}
|
||
|
{{ if $.Site.Params.editLink.enabled }}
|
||
|
{{ with $.Site.Params.editLink }}
|
||
|
{{ if eq .forge "github" }}
|
||
|
{{/*
|
||
|
link of the form:
|
||
|
https://github.com/name/repo/edit/main/content/en/path/to/foo.md
|
||
|
*/}}
|
||
|
{{ $editLink =
|
||
|
(
|
||
|
printf "https://github.com/%s/edit/%s/%s/%s"
|
||
|
.repo
|
||
|
.branch
|
||
|
$.Site.Params.contentDir
|
||
|
$path
|
||
|
)
|
||
|
}}
|
||
|
{{ else if eq .forge "gitea" }}
|
||
|
{{/*
|
||
|
link of the form:
|
||
|
gitea.example/name/repo/_edit/main/content/en/path/to/foo.md
|
||
|
*/}}
|
||
|
{{
|
||
|
$editLink =
|
||
|
(
|
||
|
printf "%s/%s/_edit/%s/%s/%s"
|
||
|
.forgeUrl
|
||
|
.repo
|
||
|
.branch
|
||
|
$.Site.Params.contentDir
|
||
|
$path
|
||
|
)
|
||
|
}}
|
||
|
{{ end }}
|
||
|
{{ end }}
|
||
|
{{ with $editLink }}
|
||
|
<span class="edit-link">
|
||
|
<br>
|
||
|
<a href='{{.}}'>Edit this page</a>
|
||
|
</span>
|
||
|
{{ else }}
|
||
|
{{ end }}
|
||
|
{{ end }}
|
||
|
{{ end }}
|