View on Github handles Windows paths

This commit is contained in:
Tobias Raabe
2018-03-23 14:10:57 +01:00
committed by Michael Noronha
parent 587b2ac961
commit 508953fc7e

View File

@@ -5,9 +5,9 @@
<div class="copyright">
{{ $length := len ( split .Site.Params.githubRepo "/" ) }}
{{ if eq $length 2 }}
<a href="https://github.com/{{ .Site.Params.githubRepo }}/tree/master/content/{{ .File.Path }}" target="_blank">View this post on GitHub</a>
<a href="https://github.com/{{ .Site.Params.githubRepo }}/tree/master/content/{{ replace .File.Path "\\" "/" }}" target="_blank">View this post on GitHub</a>
{{ else }}
<a href="https://github.com/{{ .Site.Params.githubRepo }}/content/{{ .File.Path }}" target="_blank">View this post on GitHub</a>
<a href="https://github.com/{{ .Site.Params.githubRepo }}/content/{{ replace .File.Path "\\" "/" }}" target="_blank">View this post on GitHub</a>
{{ end }}
</div>
{{ end }}