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>"
# 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 = "Gitea"
docsRepo = "https://github.com/h-enk/doks"

View File

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