From 783a1ab978ecf655d82c0ecaf9d01182bfd2e201 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 8 Oct 2021 11:10:59 +0200 Subject: [PATCH] add GitLab to path builder --- config/_default/params.toml | 2 +- layouts/partials/main/edit-page.html | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index a4d8b8e..f08e676 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -66,7 +66,7 @@ alertDismissable = true alertText = "Introducing the Doks child theme, several DX + UX updates, and more! Check out Doks v0.2" # 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" diff --git a/layouts/partials/main/edit-page.html b/layouts/partials/main/edit-page.html index 324476f..f3fbeb2 100644 --- a/layouts/partials/main/edit-page.html +++ b/layouts/partials/main/edit-page.html @@ -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 }}