{{ $filteredData := slice }}
{{ with .Params.modularDataDir }}
    {{ $data := index site.Data site.Language.Lang }}
    {{ if isset $data . }}
    {{ $data = index $data . }}
    {{ range $data }}
        {{ if .modularLayout }}
            {{ $filteredData = ($filteredData | append .) }}
        {{ end }}
    {{ end }}
    {{ end }}
{{ end }}
{{ with .Params.modularData }}
    {{ range . }}
        {{ if .modularLayout }}
            {{ $filteredData = ($filteredData | append .) }}
        {{ end }}
    {{ end }}
{{ end }}
{{ return $filteredData }}
