Skip to content

Commit

Permalink
add GitLab to path builder
Browse files Browse the repository at this point in the history
  • Loading branch information
OCram85 committed Oct 8, 2021
1 parent e4514ef commit 783a1ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 8 additions & 7 deletions layouts/partials/main/edit-page.html
Original file line number Diff line number Diff line change
@@ -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 }}

Expand Down

0 comments on commit 783a1ab

Please sign in to comment.