implement the Github edit link

This commit is contained in:
Yihui Xie
2017-06-21 13:43:23 -05:00
parent 6b05e21804
commit 15e14d207e
2 changed files with 12 additions and 0 deletions

View File

@@ -4,6 +4,17 @@
<hr/>
{{ . | markdownify }}
{{ end }}
{{ if .File.Path }}
{{ $RmdFile := (print .File.BaseFileName ".Rmd") }}
{{ if (where (readDir (print "content/" .File.Dir)) "Name" $RmdFile) }}
{{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }}
{{ else }}
{{ $.Scratch.Set "FilePath" .File.Path }}
{{ end }}
{{ with .Site.Params.GithubEdit}}
| <a href="{{ . }}{{ $.Scratch.Get "FilePath" }}">Edit this page</a>
{{ end }}
{{ end }}
</footer>
</body>
</html>