From ec1de5f5e2bc3fdcfc5d2a60e08e98640d13a151 Mon Sep 17 00:00:00 2001 From: OCram85 Date: Fri, 8 Oct 2021 07:44:49 +0200 Subject: [PATCH] adds repoHost param --- config/_default/params.toml | 5 ++++- layouts/partials/main/edit-page.html | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index fec8c77..251cc59 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -66,9 +66,12 @@ 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" +#repoHost = "Gitea" docsRepo = "https://github.com/h-enk/doks" docsRepoBranch = "master" -editPage = false +editPage = true [options] lazySizes = true diff --git a/layouts/partials/main/edit-page.html b/layouts/partials/main/edit-page.html index d685b2d..324476f 100644 --- a/layouts/partials/main/edit-page.html +++ b/layouts/partials/main/edit-page.html @@ -1,5 +1,15 @@ {{ $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 }} {{ if .Site.Params.options.multilingualMode }} @@ -11,6 +21,6 @@ - Edit this page on GitHub + Edit this page on {{ .Site.Params.repoHost }}