support an option to add .html suffixes to the generated sites #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[As usual this is kind of a hack and I'm not at all offended if you want to do this in a different way]
In the 'rdf serve' command, the server process automatically maps incoming URLs to a matching static .html file, e.g. 'http://localhost:8000/rdf/Property' becomes 'http://localhost:8000/rdf/Property.html' under the covers. If you're not using the 'rdf serve' command, you can still host the resulting static site with most webservers that have some sort of automatic rule that does a similar rewriting.
Alas, not all web servers support that option - notably github pages but also some other content management systems - so as-is out of the box the default URLs won't match what the webserver is looking for and some systems can't serve the site.
With this patch, there's a new option in rdfconfig.json that generates a URL with a .html attached to it:
We probably want a .html suffix instead of just changing the filename to not have a suffix to make it more likely the webserver serves the file with the right MIME type, though most of the pages do have enough of a header that hopefully most browsers figure out that the file should be an HTML file.
Long term hopefully more providers support something like Cloudflare's redirect - https://developers.cloudflare.com/pages/platform/redirects/
(this has been a longstanding github ask - see isaacs/github#408, you can play some games with a custom 404.html to match any missing URL and look at the request and re-serve something up)
We might not also care about this if we do something more with a single-page-app and do some javascript magic to grab the right data regardless of what the URL is, but this might be an OK interim option.
But, with this option, you can serve the site just by running
python3 -m http.server 8000
in theexplorer/public/
directory