diff --git a/layouts/partials/flex/body-aftercontent.html b/layouts/partials/flex/body-aftercontent.html
index 082865e8b04..1192c69d321 100644
--- a/layouts/partials/flex/body-aftercontent.html
+++ b/layouts/partials/flex/body-aftercontent.html
@@ -39,7 +39,7 @@
{{ $footer := print "_footer." .Lang }}
-{{ range where .Site.Pages "Source.BaseFileName" $footer }}
+{{ range where .Site.Pages "File.BaseFileName" $footer }}
{{ .Content }}
{{else}}
{{ if .Site.GetPage "page" "_footer.md" }}
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 42b9624f026..77034e350f4 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -1,5 +1,5 @@
{{ $header := print "_header." .Lang }}
- {{ range where .Site.Pages "Source.BaseFileName" $header }}
+ {{ range where .Site.Pages "File.BaseFileName" $header }}
{{ .Content }}
{{else}}
{{ if .Site.GetPage "page" "_header.md" }}
@@ -7,4 +7,4 @@
{{else}}
{{.Site.Title}}
{{end}}
-{{end}}
\ No newline at end of file
+{{end}}