Skip to content

Commit

Permalink
also consider .Rmarkdown source files
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Feb 5, 2024
1 parent fa6d9ef commit 57bf870
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
| <a href="{{ . }}{{ $.Scratch.Get "FilePath" }}">Edit this page</a>
{{ 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}}
| <a href="{{ . }}{{ $.Scratch.Get "FilePath" }}">Edit this page</a>
{{ end }}
{{ end }}
</footer>
</body>
Expand Down

0 comments on commit 57bf870

Please sign in to comment.