diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html
index c36011a..af23403 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts.html
@@ -1,17 +1,19 @@
-{{ $page_id := .File.BaseFileName }}
-{{ if .Site.Params.comments.webmention }}
- {{ $webmention_js := resources.Get "js/webmention.js" | minify }}
-
-{{ end }}
-{{ with .Site.Params.comments.cactus }}
-
+{{ if .File }}
+ {{ $page_id := .File.BaseFileName }}
+ {{ if .Site.Params.comments.webmention }}
+ {{ $webmention_js := resources.Get "js/webmention.js" | minify }}
+
+ {{ end }}
+ {{ with .Site.Params.comments.cactus }}
+
+ {{ end }}
{{ end }}