add GitLab to path builder

This commit is contained in:
OCram85 2021-10-08 11:10:59 +02:00
parent e4514efcdb
commit 783a1ab978
2 changed files with 9 additions and 8 deletions

View File

@ -66,7 +66,7 @@ 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 | Gitea | GitLab] is used for building the edit link based on git hoster
repoHost = "GitHub" repoHost = "GitHub"
#repoHost = "Gitea" #repoHost = "Gitea"
docsRepo = "https://github.com/h-enk/doks" docsRepo = "https://github.com/h-enk/doks"

View File

@ -1,14 +1,15 @@
{{ $filePath := replace .File.Path "\\" "/" }} {{ $filePath := replace .File.Path "\\" "/" }}
{{ $editPath := "null" }}
{{ $contentPath := "null"}} {{ if (eq .Site.Params.repoHost "GitHub") }}
{{ $editPath = "/blob/" }}
{{ if (eq .Site.Params.repoHost "GitHub")}} {{ else if (eq .Site.Params.repoHost "Gitea") }}
{{ $contentPath = print .Site.Params.docsRepo "/blob/" .Site.Params.docsRepoBranch "/content/" }} {{ $editPath = "/_edit/"}}
{{ else if (eq .Site.Params.repoHost "GitLab") }}
{{ $editPath = "/-/blob/" }}
{{ end }} {{ end }}
{{ if (eq .Site.Params.repoHost "Gitea")}} {{ $contentPath := print .Site.Params.docsRepo $editPath .Site.Params.docsRepoBranch "/content/" }}
{{ $contentPath = print .Site.Params.docsRepo "/_edit/" .Site.Params.docsRepoBranch "/content/" }}
{{ end }}
{{ $url := print $contentPath $filePath }} {{ $url := print $contentPath $filePath }}