diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index fbef91c9..0689dd3b 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -5,15 +5,20 @@
{{ replace . "{Year}" now.Year | 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 }}
+ {{ $RmdFile := (print .File.BaseFileName ".Rmd") }}
+ {{ $Files := readDir (print "content/" .File.Dir) }}
+ {{ if (where $Files "Name" $RmdFile) }}
+ {{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }}
+ {{ else }}
+ {{ $RmdFile := (print .File.BaseFileName ".Rmarkdown") }}
+ {{ if (where $Files "Name" $RmdFile) }}
+ {{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }}
+ {{ end }}
+ {{ end }}
+ {{ with .Site.Params.GithubEdit}}
+ | Edit this page
+ {{ end }}
{{ end }}