提交 246eb247 编写于 作者: A Alan Greene 提交者: tekton-robot

Update 'Edit this page' link to point to correct project repo

Add support for a custom page param that can be used to point the
links in the sidebar to the correct project repos.

'Edit this page' will open the editor pointing to the correct file
in the project repo, instead of trying to find it in the website repo.

'Create an issue' will open the new issue UI in the target project repo.
上级 59e714e8
......@@ -74,7 +74,7 @@ weight = 1
version_menu = "Releases"
# Repository configuration (URLs for in-page links to opening issues and suggesting changes)
github_repo = "https://github.com/tektoncd/website/"
github_repo = "https://github.com/tektoncd/website"
# Specify a value here if your content directory is not in your repo's root directory
# github_subdir = ""
......
......@@ -5,20 +5,22 @@
{{ if $gh_repo }}
<div class="td-page-meta ml-2 pb-1 pt-2 mb-0">
{{ $editURL := printf "%s/edit/master/content/%s" $gh_repo .Path }}
{{ if and ($gh_subdir) (.Site.Language.Lang) }}
{{ if $gh_project_repo }}
{{ $filename := .File.LogicalName }}
{{ if and $gh_project_repo (eq $filename "_index.md") }}
{{ $filename = "README.md" }}
{{ end }}
{{ $editURL = printf "%s/edit/master/docs/%s" $gh_project_repo $filename }}
{{ else if and ($gh_subdir) (.Site.Language.Lang) }}
{{ $editURL = printf "%s/edit/master/%s/content/%s/%s" $gh_repo $gh_subdir ($.Site.Language.Lang) $.Path }}
{{ else if .Site.Language.Lang }}
{{ $editURL = printf "%s/edit/master/content/%s/%s" $gh_repo ($.Site.Language.Lang) .Path }}
{{ else if $gh_subdir }}
{{ $editURL = printf "%s/edit/master/%s/content/%s" $gh_repo $gh_subdir $.Path }}
{{ end }}
{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (htmlEscape $.Title )}}
{{ $issuesURL := printf "%s/issues/new?title=%s" $gh_repo (htmlEscape ($.Title | default $.LinkTitle ))}}
<a href="{{ $editURL }}" target="_blank"><i class="fa fa-edit fa-fw"></i> {{ T "post_edit_this" }}</a>
<a href="{{ $issuesURL }}" target="_blank"><i class="fab fa-github fa-fw"></i> {{ T "post_create_issue" }}</a>
{{ if $gh_project_repo }}
{{ $project_issueURL := printf "%s/issues/new" $gh_project_repo }}
<a href="{{ $project_issueURL }}" target="_blank"><i class="fas fa-tasks fa-fw"></i> {{ T "post_create_project_issue" }}</a>
{{ end }}
</div>
{{ end }}
{{ end }}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册