Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow compiling Markdown pages without HTML suffix or generating a new directory with index.html / Pretty URLs without new directory #784

Open
artemislena opened this issue Jul 30, 2020 · 1 comment

Comments

@artemislena
Copy link

This may as well be a documentation bug, however https://cobalt-org.github.io/docs/permalink/ states

When you omit the file extension (e.g. .html) in your permalink, Cobalt will treat the permalink as a folder and create the file with the name index.html.

An alternative where one can save the file directly without .html suffix would be appreciated. Why? One possible reason is here, but I'm sure there are plenty of more, such as simply having pretty URLs (without having to generate a new directory).

@epage
Copy link
Member

epage commented Jul 31, 2020

Maybe I missed something but when I followed that link and then again to what it links to, the suggestion seemed to be to not remove extensions from your files but to not have them exist in your links.

File name extension. This is a very common one. "cgi", even ".html" is something which will change. You may not be using HTML for that page in 20 years time, but you might want today's links to it to still be valid. The canonical way of making links to the W3C site doesn't use the extension.(how?)

Following the how link:

If you are using, for example, Apache, you can set it up to do content negotiation. You keep the file extension (such as .png) on the file (e.g. mydog.png), but refer to the web resource without it. Apache then checks the directory for all files with that name and any extension, and it can also pick the best one out of a set (e.g. GIF and PNG). (You do not have to put different types of file in different directories, in fact the content negotiation won't work if you do.)

  • Set up your server to do content negotiation
  • Make references always to the URI without the extension

atm cobalt doesn't generate too many URIs but in general, this would look like:

  • Ensure cobalt serve can handle content negotation
  • Allow people to opt-in to extension-less URIs on a site-wide basis
    • Use this within pagination for our URI generation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants