Skip to content

Commit

Permalink
add template for github edit in footer
Browse files Browse the repository at this point in the history
  • Loading branch information
njtierney committed Jun 21, 2017
1 parent ae337e5 commit 2bc2dd0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ footnotereturnlinkcontents = "↩"

[params]
description = "Credibly Curious"
GithubEdit = "https://github.com/rbind/njtierney.com/edit/feature/github-edit/exampleSite/content/"

This comment has been minimized.

Copy link
@yihui

yihui Jun 22, 2017

Member

That is incorrect. I just added another paragraph at yihui/hugo-xmin#6. In your case, your edit link should be https://github.com/rbind/njtierney.com/edit/master/content/.

This comment has been minimized.

Copy link
@njtierney

njtierney Jun 22, 2017

Author Collaborator

OK thank you so much for picking up on that, Yihui! I'll push the changes soon

footer = "© [Nicholas Tierney](https://njtierney.com) 2017 | [Github](https://github.com/njtierney) | [Twitter](https://twitter.com/nj_tierney)"
11 changes: 11 additions & 0 deletions themes/hugo-xmin/layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>

0 comments on commit 2bc2dd0

Please sign in to comment.