Added new 'GitForge' param for non GitHub repos (#403)

* Added new 'GitForge' param for non-git repos

* Solved comments

Co-authored-by: Pablo Marcos <codebergflamingo@staplehorse.anonaddy.com>
Co-authored-by: Emruz Hossain <hossainemruz@gmail.com>
This commit is contained in:
Pablo Marcos 2021-09-07 20:28:31 +02:00 committed by GitHub
parent d155f2063b
commit e8e23ed9a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,8 +70,19 @@
<!--- Improve this page button --->
{{ if site.Params.GitRepo }}
{{ if site.Params.GitBranch }}
{{ .Scratch.Set "GitBranch" site.Params.GitBranch }}
{{ else }}
{{ .Scratch.Set "GitBranch" "main" }}
{{ end }}
<div class="btn-improve-page">
<a href="{{ site.Params.GitRepo }}/edit/{{ site.Params.GitBranch }}/content/{{ .File.Path }}" title="{{ i18n "improve_this_page" }}" target="_blank" rel="noopener">
{{ if ( eq site.Params.GitForge "gitlab" ) }}
<a href="{{ site.Params.GitRepo }}/-/edit/{{ .Scratch.Get "GitBranch" }}/{{ .File.Path }}" title="{{ i18n "improve_this_page" }}" target="_blank" rel="noopener">
{{ else if ( eq site.Params.GitForge "gitea" ) }}
<a href="{{ site.Params.GitRepo }}/_edit/{{ .Scratch.Get "GitBranch" }}/content/{{ .File.Path }}" title="{{ i18n "improve_this_page" }}" target="_blank" rel="noopener">
{{ else }} <!--- Make Github-style the default -->
<a href="{{ site.Params.GitRepo }}/edit/{{ .Scratch.Get "GitBranch" }}/content/{{ .File.Path }}" title="{{ i18n "improve_this_page" }}" target="_blank" rel="noopener">
{{ end }}
<i class="fas fa-code-branch"></i>
{{ i18n "improve_this_page" }}
</a>