Add Edit on GitHub (#116)

resolved #115

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

```yml
params:
  repo: "https://github.com/go-gitea/gitea"
  docContentPath: "docs/content"
```

Signed-off-by: Xinyu Zhou <i@sourcehut.net>
Reviewed-on: https://gitea.com/gitea/theme/pulls/116
Reviewed-by: silverwind <silverwind@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Xinyu Zhou <i@sourcehut.net>
Co-committed-by: Xinyu Zhou <i@sourcehut.net>
This commit is contained in:
Xinyu Zhou
2022-11-30 21:30:57 +08:00
committed by Lunny Xiao
parent 3abdb2e66a
commit d84039b903
8 changed files with 22 additions and 0 deletions

View File

@@ -12,3 +12,6 @@
- id: page_next
translation: "Next"
- id: edit_this_page
translation: "Edit this page"

View File

@@ -12,3 +12,6 @@
- id: page_next
translation: "Volgende"
- id: edit_this_page
translation: "Bewerk deze pagina"

View File

@@ -12,3 +12,6 @@
- id: page_next
translation: "Próximo"
- id: edit_this_page
translation: "Edite essa página"

View File

@@ -12,3 +12,6 @@
- id: page_next
translation: "后一页"
- id: edit_this_page
translation: "编辑此页面"

View File

@@ -12,3 +12,6 @@
- id: page_next
translation: "下一頁"
- id: edit_this_page
translation: "編輯此頁面"

View File

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

View File

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

View File

@@ -0,0 +1,3 @@
{{- if and .Site.Params.repo .File -}}
<a href="{{ .Site.Params.repo }}/edit/main/{{ .Site.Params.docContentPath }}/{{ .File.Path }}">{{- T "edit_this_page" -}}</a>
{{- end -}}