Theme development: fileExists: index files

I dug through the docs, but didn’t find any reference in getting the index file.

It’d be pretty dumb detecting if or _index.html or index.html or etc exists.

I expected there to be an indexPath variable, so you could do {{ if (fileExists indexPath) -}}.

Is there one and did I miss something or is it time for a MR?

.Site.Home gives the same result. I’d expect it to be empty, but it is the value of title instead. I guess I can work around it by comparing if the match or not.

I’m not sure what the question is? .Site.Home returns a reference to the Page variable for the homepage.

I can check if an index file (not) exists with {{ (in .Site.Home .Site.Title ) }}, but I thought I could do something like {{ (eq .Site.Home "") }}.

I also found out, that an another way to check, if an index file is present is {{ (eq .Title "" ) }}, as (unlike .Site.Title), .Title is only present, if there is no index file.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.