diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 6a6687c6..1eb88abb 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -5,15 +5,20 @@
{{ . | 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 }}