提交 bfda29b7 编写于 作者: G Geri Ochoa 提交者: tekton-robot

Create custom meta-links

Because Tekton imports content from several repos, this custom partial
ensures that the "edit" link points to the correct location.
上级 35de0504
{{ if .Path }}
{{ $gh_repo := ($.Param "github_repo") }}
{{ $gh_subdir := ($.Param "github_subdir") }}
{{ $gh_project_repo := ($.Param "github_project_repo") }}
{{ if $gh_repo }}
<div class="td-page-meta ml-2 pb-1 pt-2 mb-0">
{{ $editURL := printf "%s/edit/main/content/%s" $gh_repo .Path }}
{{ if $gh_project_repo }}
{{ $filename := .File.LogicalName }}
{{ if and $gh_project_repo (eq $filename "_index.md") }}
{{ $filename = "README.md" }}
{{ end }}
{{ $editURL = printf "%s/edit/main/docs/%s" $gh_project_repo $filename }}
{{ else if and ($gh_subdir) (.Site.Language.Lang) }}
{{ $editURL = printf "%s/edit/main/%s/content/%s/%s" $gh_repo $gh_subdir ($.Site.Language.Lang) $.Path }}
{{ else if .Site.Language.Lang }}
{{ $editURL = printf "%s/edit/main/content/%s/%s" $gh_repo ($.Site.Language.Lang) .Path }}
{{ else if $gh_subdir }}
{{ $editURL = printf "%s/edit/main/%s/content/%s" $gh_repo $gh_subdir $.Path }}
{{ end }}
{{ $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>
</div>
{{ end }}
{{ end }}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册