FransBouma / DocNet

Your friendly static documentation generator, using markdown files to build the content.
http://fransbouma.github.io/DocNet/
248 stars 36 forks source link

Feature request: urls without ".htm" #44

Closed AndreyAkinshin closed 7 years ago

AndreyAkinshin commented 7 years ago

If I create a "MySection.md" file using docnet, it will be transformed to MySection.htm with url like http://mydomain.com/MySection.htm which looks ugly and old school. I want to form url in the http://mydomain.com/MySection/ format. It should be easy to implement: we just have to generate MySection folder with index.htm file instead of MySection.md file. Such feature could have an additional parameter in docnet.json wich allows enabling of disabling it.

FransBouma commented 7 years ago

Folder based references don't work offline on disk, which can be a big problem, but if the doc site is only on-line that can work, I guess. I'm a bit puzzled about the 'it's ugly / oldskool' argument, to be honest. ;) I get that references to html pages directly seem to look 'ugly' with the world of MVC, but is it really that big of a problem? Instead of referring to a folder it's referring to a page, 4 chars difference.

With '#' directives to sub sections into the page the 'index.htm' has to be used anyway or does http://mydomain.com/MySection/#subsection work? (I honestly don't know)

AndreyAkinshin commented 7 years ago

A lot of modern sites support such url style. For example, the url of this page is https://github.com/FransBouma/DocNet/issues/44 instead of https://github.com/FransBouma/DocNet/issues/44.htm =).

It would be really nice to have this optional feature for online only sites.

With '#' directives to sub sections into the page the 'index.htm' has to be used anyway or does http://mydomain.com/MySection/#subsection work?

Yes, it works fine. An example: http://aakinshin.net/en/blog/dotnet/stopwatch/#operation-systems (by the way, my blog also uses the same approach: I have the stopwatch folder with the index.html file inside instead of the stopwatch.html file).

FransBouma commented 7 years ago

Yes, the folder structure is useful for MVC routing, though when I try: http://aakinshin.net/en/blog/dotnet/stopwatch/index.html#operation-systems it fails, likely due to failed mvc routing as well. Anyway, it's easy to test of course whether it works or not on a non-MVC static site without routing logic. :)

AndreyAkinshin commented 7 years ago

http://aakinshin.net/en/blog/dotnet/stopwatch/index.html#operation-systems works fine to me (it's just a static page from here: https://github.com/AndreyAkinshin/aakinshin.net/blob/gh-pages/en/blog/dotnet/stopwatch/index.html). What kind of problem do you have?

FransBouma commented 7 years ago

Weird, it works indeed with your url. I must have made a typo somewhere when I tried! Ok, so that's not a problem then! :)

AndreyAkinshin commented 7 years ago

Awesome, thanks!

AndreyAkinshin commented 7 years ago

Hey @FransBouma, any progress with the issue? I want to have this feature in BenchmarkDotNet. =)

FransBouma commented 7 years ago

No time at the moment, sorry. Perhaps this week but as I won't use this feature in our own docs it won't get a high priority so I have to work on it when I have time outside work.

(edit) It's likely not a lot of work, so I'll see what I can do for you this week.

FransBouma commented 7 years ago

Well, this is surprisingly more work than one would think. The main issue is that an element's URL is generated by a property without external data. The parameter however is located in the configuration which isn't global, so it can't reach that, ergo it doesn't know if it should create folders instead of files for a markdown file. Making it know it should do that requires either the config to be global / singleton or I have to pass the parameter to the element objects first (which is rather silly too).

Not happy with either situation tbh, so as this is a cosmetic change and not a feature needed for making the tool work, I leave it as it is now. Perhaps I get a different insight later.

FransBouma commented 7 years ago

@AndreyAkinshin It's implemented in v0.16, which we'll release shortly :)

AndreyAkinshin commented 7 years ago

@FransBouma, awesome! Waiting for v0.16.

FransBouma commented 7 years ago

v0.16 has been released yesterday :) You can find it at the releases tab :) https://github.com/FransBouma/DocNet/releases

FransBouma commented 7 years ago

Released