adds repoHost param

This commit is contained in:
OCram85 2021-10-08 07:44:49 +02:00
parent bcfce0b652
commit ec1de5f5e2
2 changed files with 16 additions and 3 deletions

View File

@ -66,9 +66,12 @@ alertDismissable = true
alertText = "Introducing the Doks child theme, several DX + UX updates, and more! <a class=\"alert-link stretched-link\" href=\"https://getdoks.org/blog/doks-v0.2/\">Check out Doks v0.2</a>" alertText = "Introducing the Doks child theme, several DX + UX updates, and more! <a class=\"alert-link stretched-link\" href=\"https://getdoks.org/blog/doks-v0.2/\">Check out Doks v0.2</a>"
# Edit Page # Edit Page
# repoHost [Github | Gitea ] is used for building the edit link based on git hoster
repoHost = "GitHub"
#repoHost = "Gitea"
docsRepo = "https://github.com/h-enk/doks" docsRepo = "https://github.com/h-enk/doks"
docsRepoBranch = "master" docsRepoBranch = "master"
editPage = false editPage = true
[options] [options]
lazySizes = true lazySizes = true

View File

@ -1,5 +1,15 @@
{{ $filePath := replace .File.Path "\\" "/" }} {{ $filePath := replace .File.Path "\\" "/" }}
{{ $contentPath := print .Site.Params.docsRepo "/blob/" .Site.Params.docsRepoBranch "/content/" }}
{{ $contentPath := "null"}}
{{ if (eq .Site.Params.repoHost "GitHub")}}
{{ $contentPath = print .Site.Params.docsRepo "/blob/" .Site.Params.docsRepoBranch "/content/" }}
{{ end }}
{{ if (eq .Site.Params.repoHost "Gitea")}}
{{ $contentPath = print .Site.Params.docsRepo "/_edit/" .Site.Params.docsRepoBranch "/content/" }}
{{ end }}
{{ $url := print $contentPath $filePath }} {{ $url := print $contentPath $filePath }}
{{ if .Site.Params.options.multilingualMode }} {{ if .Site.Params.options.multilingualMode }}
@ -11,6 +21,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2">
<path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path> <path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path>
</svg> </svg>
Edit this page on GitHub Edit this page on {{ .Site.Params.repoHost }}
</a> </a>
</p> </p>