diff --git a/config/_default/params.toml b/config/_default/params.toml index fec8c77..f08e676 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -66,6 +66,9 @@ alertDismissable = true alertText = "Introducing the Doks child theme, several DX + UX updates, and more! Check out Doks v0.2" # Edit Page +# 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" docsRepoBranch = "master" editPage = false diff --git a/layouts/partials/main/edit-page.html b/layouts/partials/main/edit-page.html index d685b2d..e8c901a 100644 --- a/layouts/partials/main/edit-page.html +++ b/layouts/partials/main/edit-page.html @@ -1,5 +1,16 @@ {{ $filePath := replace .File.Path "\\" "/" }} -{{ $contentPath := print .Site.Params.docsRepo "/blob/" .Site.Params.docsRepoBranch "/content/" }} +{{ $editPath := "null" }} + +{{ 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 }} + +{{ $contentPath := print .Site.Params.docsRepo $editPath .Site.Params.docsRepoBranch "/content/" }} + {{ $url := print $contentPath $filePath }} {{ if .Site.Params.options.multilingualMode }} @@ -11,6 +22,6 @@ - Edit this page on GitHub + Edit this page on {{ .Site.Params.repoHost }}