From 6560d588d0bdb2e0b8ffb4f1f4984e7068047ee1 Mon Sep 17 00:00:00 2001 From: Xinyu Zhou Date: Wed, 30 Nov 2022 13:13:41 +0800 Subject: [PATCH] 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 --- i18n/en-US.yaml | 3 +++ i18n/nl-NL.yaml | 3 +++ i18n/pt-BR.yaml | 3 +++ i18n/zh-CN.yaml | 3 +++ i18n/zh-TW.yaml | 3 +++ layouts/doc/single.html | 2 ++ layouts/page/single.html | 2 ++ layouts/partials/edit-this.html | 3 +++ 8 files changed, 22 insertions(+) create mode 100644 layouts/partials/edit-this.html diff --git a/i18n/en-US.yaml b/i18n/en-US.yaml index 38a0b1c..e873d27 100644 --- a/i18n/en-US.yaml +++ b/i18n/en-US.yaml @@ -12,3 +12,6 @@ - id: page_next translation: "Next" + +- id: edit_on_github + translation: "Edit on GitHub" diff --git a/i18n/nl-NL.yaml b/i18n/nl-NL.yaml index bde68f6..5399cb6 100644 --- a/i18n/nl-NL.yaml +++ b/i18n/nl-NL.yaml @@ -12,3 +12,6 @@ - id: page_next translation: "Volgende" + +- id: edit_on_github + translation: "Bewerken op GitHub" diff --git a/i18n/pt-BR.yaml b/i18n/pt-BR.yaml index 70cfbac..cf93d9d 100644 --- a/i18n/pt-BR.yaml +++ b/i18n/pt-BR.yaml @@ -12,3 +12,6 @@ - id: page_next translation: "Próximo" + +- id: edit_on_github + translation: "Edite em GitHub" diff --git a/i18n/zh-CN.yaml b/i18n/zh-CN.yaml index 75256f7..4976c4c 100644 --- a/i18n/zh-CN.yaml +++ b/i18n/zh-CN.yaml @@ -12,3 +12,6 @@ - id: page_next translation: "后一页" + +- id: edit_on_github + translation: "在 GitHub 上编辑此页面" diff --git a/i18n/zh-TW.yaml b/i18n/zh-TW.yaml index ec03216..b945191 100644 --- a/i18n/zh-TW.yaml +++ b/i18n/zh-TW.yaml @@ -12,3 +12,6 @@ - id: page_next translation: "下一頁" + +- id: edit_on_github + translation: "在 GitHub 上編輯此頁面" diff --git a/layouts/doc/single.html b/layouts/doc/single.html index 02bc08b..31a055a 100644 --- a/layouts/doc/single.html +++ b/layouts/doc/single.html @@ -10,6 +10,8 @@
{{ .Content }} +
+ {{ partial "edit-this" . }}
diff --git a/layouts/page/single.html b/layouts/page/single.html index 830fd38..71f705b 100644 --- a/layouts/page/single.html +++ b/layouts/page/single.html @@ -10,6 +10,8 @@
{{ .Content }} +
+ {{ partial "edit-this" . }}
diff --git a/layouts/partials/edit-this.html b/layouts/partials/edit-this.html new file mode 100644 index 0000000..5b53e01 --- /dev/null +++ b/layouts/partials/edit-this.html @@ -0,0 +1,3 @@ +{{- if and .Site.Params.github_doc_repository .File -}} +{{- T "edit_on_github" -}} +{{- end -}} \ No newline at end of file