Is there a way to map files with extensions my_file.json
to URLs that do not have URLs my_file
such that the mime type is correctly preserved?
Do you mean you want the URL to be served without an extension?
For example:
https://example.com/my_file.json
To be served as (with same MIME type):
https://example.com/my_file
I don’t believe there’s anything within Jekyll to do that – Jekyll only builds a directory of static files. The files are then served as URLs by a web server/service, like Apache, Nginx, Github’s custom service, Netlify, etc.
Web servers/services generally map URLs to files in a straightforward way, but there are variations depending on default or custom configuration. For example, Apache can be configured serve extension-less URLs via its MultiViews feature. Similarly, Github’s web service allows extension-less URLs by default.
Maybe this could be done with defaults to static files, then creating some code to handle these files.