From 2bc2dd0a26d2ed015aa8af78fd13bd627150302c Mon Sep 17 00:00:00 2001 From: Nicholas Tierney Date: Thu, 22 Jun 2017 08:02:09 +1000 Subject: [PATCH] add template for github edit in footer --- config.toml | 1 + themes/hugo-xmin/layouts/partials/footer.html | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/config.toml b/config.toml index 6b6eb4c..a4e3b11 100644 --- a/config.toml +++ b/config.toml @@ -38,4 +38,5 @@ footnotereturnlinkcontents = "↩" [params] description = "Credibly Curious" + GithubEdit = "https://github.com/rbind/njtierney.com/edit/feature/github-edit/exampleSite/content/" footer = "© [Nicholas Tierney](https://njtierney.com) 2017 | [Github](https://github.com/njtierney) | [Twitter](https://twitter.com/nj_tierney)" diff --git a/themes/hugo-xmin/layouts/partials/footer.html b/themes/hugo-xmin/layouts/partials/footer.html index 3f46ea5..af72196 100644 --- a/themes/hugo-xmin/layouts/partials/footer.html +++ b/themes/hugo-xmin/layouts/partials/footer.html @@ -4,6 +4,17 @@
{{ . | 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}} + | Edit this page + {{ end }} + {{ end }}