jnordberg / wintersmith

A flexible static site generator
http://wintersmith.io/
MIT License
3.5k stars 332 forks source link

Fallback to the normalized URI when determining the content type of files in the preview server #303

Closed nhinds closed 8 years ago

nhinds commented 8 years ago

Enables serving extensionless HTML files, since the normalized URI is /path/index.html

Without this, extensionless files are served as application/octet-stream (the default content type from the MIME module)

jnordberg commented 8 years ago

Hmm, does this really work? Wouldn't the content that has a filename property without an extension just be 404 in any case?

nhinds commented 8 years ago

normalizeUri turns /foo into /foo/index.html, since #252, which fixed the 404 you mention.

I have tested this change on my site which has e.g. about.md with a filename of about. Without this change wintersmith build generates the page correctly into a file called about, and it works when served from S3 with content type set to text/html, but wintersmith preview forces browsers to download the page rather than displaying it.

jnordberg commented 8 years ago

Ok, I don't think having this could hurt. I'll publish it with the next release. Thanks!