Add `Edit on GitHub`

resolved #115

The following configuration need to be added to [config.yml](https://github.com/go-gitea/gitea/blob/main/docs/config.yaml)

```yml
params:
  github_doc_repository: "https://github.com/go-gitea/gitea"
  github_doc_repository_path: "docs/content"
```

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
This commit is contained in:
Xinyu Zhou 2022-11-30 13:13:41 +08:00
parent 3abdb2e66a
commit 6560d588d0
No known key found for this signature in database
GPG Key ID: D8E8DD6C9CC24EB6
8 changed files with 22 additions and 0 deletions

View File

@ -12,3 +12,6 @@
- id: page_next
translation: "Next"
- id: edit_on_github
translation: "Edit on GitHub"

View File

@ -12,3 +12,6 @@
- id: page_next
translation: "Volgende"
- id: edit_on_github
translation: "Bewerken op GitHub"

View File

@ -12,3 +12,6 @@
- id: page_next
translation: "Próximo"
- id: edit_on_github
translation: "Edite em GitHub"

View File

@ -12,3 +12,6 @@
- id: page_next
translation: "后一页"
- id: edit_on_github
translation: "在 GitHub 上编辑此页面"

View File

@ -12,3 +12,6 @@
- id: page_next
translation: "下一頁"
- id: edit_on_github
translation: "在 GitHub 上編輯此頁面"

View File

@ -10,6 +10,8 @@
<div class="column is-three-quarters">
<div class="content">
{{ .Content }}
<hr>
{{ partial "edit-this" . }}
</div>
</div>
</div>

View File

@ -10,6 +10,8 @@
<div class="column">
<div class=" content">
{{ .Content }}
<hr>
{{ partial "edit-this" . }}
</div>
</div>
</div>

View File

@ -0,0 +1,3 @@
{{- if and .Site.Params.github_doc_repository .File -}}
<a href="{{ .Site.Params.github_doc_repository }}/edit/main/{{ .Site.Params.github_doc_repository_path }}/{{ .File.Path }}" class="edit-page"><i class="fas fa-pen-square"></i>{{- T "edit_on_github" -}}</a>
{{- end -}}