Skip to content

Commit 2bc2dd0

Browse files
committed
add template for github edit in footer
1 parent ae337e5 commit 2bc2dd0

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ footnotereturnlinkcontents = "↩"
3838

3939
[params]
4040
description = "Credibly Curious"
41+
GithubEdit = "https://github.com/rbind/njtierney.com/edit/feature/github-edit/exampleSite/content/"
4142
footer = "© [Nicholas Tierney](https://njtierney.com) 2017 | [Github](https://github.com/njtierney) | [Twitter](https://twitter.com/nj_tierney)"

themes/hugo-xmin/layouts/partials/footer.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44
<hr/>
55
{{ . | markdownify }}
66
{{ end }}
7+
{{ if .File.Path }}
8+
{{ $RmdFile := (print .File.BaseFileName ".Rmd") }}
9+
{{ if (where (readDir (print "content/" .File.Dir)) "Name" $RmdFile) }}
10+
{{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }}
11+
{{ else }}
12+
{{ $.Scratch.Set "FilePath" .File.Path }}
13+
{{ end }}
14+
{{ with .Site.Params.GithubEdit}}
15+
| <a href="{{ . }}{{ $.Scratch.Get "FilePath" }}">Edit this page</a>
16+
{{ end }}
17+
{{ end }}
718
</footer>
819
</body>
920
</html>

0 commit comments

Comments
 (0)