core icon indicating copy to clipboard operation
core copied to clipboard

Static HTML sitelets: add option to not add .html suffix to links

Open Tarmil opened this issue 6 years ago • 4 comments

In Html project mode, context.Link() adds a .html suffix to URLs, so that the link points directly to a generated file. However some hosts (like GitHub pages) can also serve a file foo.html when browsing URL /foo, so it would be nice to have the option to not add .html to URLs.

It's also easy to test a static site locally so that URL /foo points to file foo.html:

dotnet tool install -g dotnet-serve
dotnet serve --default-extensions:html

Tarmil avatar Oct 11 '19 08:10 Tarmil

Yes, good idea, should be quick to implement.

granicz avatar Oct 11 '19 13:10 granicz

@Tarmil Have you imagined this as an extra project setting? So not an optional argument to Link but always global, like "linksWithNoHtmlExt" in wsconfig.jon. This name is a bit long, any ideas for shorter one? Thanks!

Jand42 avatar Oct 14 '19 09:10 Jand42

I'd prefer if we could pass in whatever extension we like, none if empty. So something like staticLinkExtension with a default of ".html".

granicz avatar Oct 14 '19 09:10 granicz

@Jand42 Yes I was definitely thinking of it as a compiler option in wsconfig.json.

Tarmil avatar Oct 14 '19 09:10 Tarmil