Skip to content

Commit e1e921e

Browse files
committed
.File may be nil, in which case .File.Path will error
1 parent 1cafaca commit e1e921e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

layouts/_partials/footer.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
<hr/>
55
{{ replace . "{Year}" now.Year | markdownify }}
66
{{ end }}
7-
{{ if .File.Path }}
8-
{{ $.Scratch.Set "FilePath" .File.Path }}
9-
{{ $RmdFile := (print .File.BaseFileName ".Rmd") }}
10-
{{ $Files := readDir (print "content/" .File.Dir) }}
7+
{{ with .File }}
8+
{{ $.Scratch.Set "FilePath" .Path }}
9+
{{ $RmdFile := (print .BaseFileName ".Rmd") }}
10+
{{ $Files := readDir (print "content/" .Dir) }}
1111
{{ if (where $Files "Name" $RmdFile) }}
12-
{{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }}
12+
{{ $.Scratch.Set "FilePath" (print .Dir $RmdFile) }}
1313
{{ else }}
14-
{{ $RmdFile := (print .File.BaseFileName ".Rmarkdown") }}
14+
{{ $RmdFile := (print .BaseFileName ".Rmarkdown") }}
1515
{{ if (where $Files "Name" $RmdFile) }}
16-
{{ $.Scratch.Set "FilePath" (print .File.Dir $RmdFile) }}
16+
{{ $.Scratch.Set "FilePath" (print .Dir $RmdFile) }}
1717
{{ end }}
1818
{{ end }}
19-
{{ with .Site.Params.GithubEdit}}
19+
{{ with $.Site.Params.GithubEdit}}
2020
| <a href="{{ . }}{{ $.Scratch.Get "FilePath" }}">Edit this page</a>
2121
{{ end }}
2222
{{ end }}

0 commit comments

Comments
 (0)