Merge pull request #459 from limichange/patch-4

fix: edit-page multi-language support
This commit is contained in:
Henk Verlinde 2021-09-21 15:31:53 +02:00 committed by GitHub
commit 059891808e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 1 deletions

View File

@ -1 +1,16 @@
<p class="edit-page"><a href="{{ .Site.Params.docsRepo }}/blob/main/content/{{replace .File.Path "\\" "/" }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>Edit this page on GitHub</a></p> {{ $filePath := replace .File.Path "\\" "/" }}
{{ $contentPath := print .Site.Params.docsRepo "/blob/" .Site.Params.docsRepoBranch "/content/" }}
{{ $url := print $contentPath $filePath }}
{{ if .Site.Params.options.multilingualMode }}
{{ $url = print $contentPath .Lang "/" $filePath }}
{{ end }}
<p class="edit-page">
<a href="{{ $url }}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-2">
<path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path>
</svg>
Edit this page on GitHub
</a>
</p>