Are there other implicit index files supported?

I can’t find this in docs and curious if there is support for index files other than index.html ?

That is /directory/index.html is automatically available as /directory/

Would /feed/index.xml be available as /feed/ with correct XML headers and such? Any other kind of index file?

This is initially prompted by Hugo having feeds at index.xml and needing to serve them at /feed/ endpoints.

I know that can be done with redirect/rewrite (which I currently do), but this got me interested are there any other index files supported, or is it only index.html.

this is an interesting question, @Rarst. I will try and get some extra eyes on this to get more information.

Hi @Rarst,

I chatted with our docs team about this today and our common consensus is that if you build an xml file with your app, we will serve that xml file, it is completely up to you to set your project up the way you want to. It’s the browser that loads whichever index file you create.

Do keep in mind though that if you have both an index.html and an index.xml, I do believe the index.html overrides any other file type/extension.

1 Like

I chatted with our docs team about this today and our common consensus is that if you build an xml file with your app, we will serve that xml file

To be clear you would serve as directory index and with XML headers?

What about any other type of file?

It’s the browser that loads whichever index file you create.

It is a web server that chooses which file is served as directory index (which is commonly a selection of multiple possible files). The index.html part is not visible or decided by the browser when a directory is served to it by a web server.

E.g. DirectoryIndex in Apache allows you to configure which files are used as index:

DirectoryIndex index.html index.txt  /cgi-bin/index.pl

Do keep in mind though that if you have both an index.html and an index.xml , I do believe the index.html overrides any other file type/extension.

This does not clarify what happens if I only have index.xml ? index.someOtherFormat ?

To be clear we ONLY automatically serve index.html

The rest is “servable by you, by explicit URL, only”.

We do not now, and do not intend to, support anything else. If you want to “automagically” load a file at a path that isn’t called index.html, you can certainly use a redirect (cf https://docs.netlify.com/routing/redirects/) to make it happen:

/feed /feed/index.xml 301

Hope that helps!

1 Like

Thank you, that answers my question. :slight_smile:

For anyone reading later, rewrite, rather than redirect, can be closer to accomplish this specific thing:

/feed /feed/index.xml 200
1 Like