diff --git a/layouts/partials/flex/body-aftercontent.html b/layouts/partials/flex/body-aftercontent.html
index fc7b550..3d902bd 100644
--- a/layouts/partials/flex/body-aftercontent.html
+++ b/layouts/partials/flex/body-aftercontent.html
@@ -37,9 +37,14 @@
{{ $footer := print "_footer." .Lang }}
- {{ range where .Site.Pages "File.BaseFileName" $footer }}
- {{ .Content }}
- {{else}}
+ {{ $found := false }}
+ {{ range .Site.Pages }}
+ {{ if and .File (eq .File.BaseFileName $footer) }}
+ {{ .Content }}
+ {{ $found = true }}
+ {{ end }}
+ {{ end }}
+ {{ if not $found }}
{{ if .Site.GetPage "page" "_footer.md" }}
{{(.Site.GetPage "page" "_footer.md").Content}}
{{else}}