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 using extension-less URLs #413

Closed
julen opened this issue Jan 23, 2018 · 5 comments
Closed

Allow using extension-less URLs #413

julen opened this issue Jan 23, 2018 · 5 comments
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: claimed Issue has been claimed by a contributor who plans to work on it.

Comments

@julen
Copy link

julen commented Jan 23, 2018

Is this a bug report?

No.

Have you read the Contributing Guidelines?

Yes.

Environment

Any.

Expected Behavior

Since Docusaurus has been designed to work well with GitHub Pages, it would be ideal if the links it generates via markdown references also supported extension-less URLs.

Note GitHub supports this out-of-the box: simply remove the .html suffix from any published pages and it just works.

Actual Behavior

Docusaurus always creates links with the .html extension appended, and there is no way to change that.

In practical terms, this means there's no chance of using GitHub Pages' feature of removing file extension suffixes from URLs without sacrificing consistency.

Reproducible Demo

Example:

As a side note, also note how index.html can also be removed (which in conjunction with #323 would allow for clean URLs):

@JoelMarcey
Copy link
Contributor

Hi @julen - I agree we should support this. Thanks!

@JoelMarcey JoelMarcey added the feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. label Feb 27, 2018
@JoelMarcey JoelMarcey added difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. mentorship labels Feb 28, 2018
@InternetExplorer7
Copy link
Contributor

Hi, I think I've addressed this issue in the referenced issue above! Please feel free to take a look!

@InternetExplorer7
Copy link
Contributor

For some reason, http://localhost:3000/blog/.../introducing-docusaurus/index.html
gives a page with a response code of 200 and a blank page is rendered. Any idea why that may be returning a 200 response?

Other than that, every page still works the same with extensions, and every page (except this /blog one) works without the .html extension!

@JoelMarcey JoelMarcey added the status: claimed Issue has been claimed by a contributor who plans to work on it. label Mar 19, 2018
This was referenced Mar 19, 2018
@yangshun yangshun removed the status: claimed Issue has been claimed by a contributor who plans to work on it. label May 4, 2018
@yangshun
Copy link
Contributor

yangshun commented May 4, 2018

Re-post of my comment in #515 in case anyone wants to take this up in future:

Changing the routing in the server only works in development mode when the pages are being served via Express. In production, the site is built as static files and is served like a file directory server. After the build command is ran, th extensionless URLs wouldn't work because there's no /path/index.html file present when you try to access /path.

Try running yarn build and running a local webserver in the build directory and see for yourself. For example, for /path/installation.html you would need to generate the following directories and files:

├── path
│   ├── installation.html
│   └── installation
│       └── index.html

so that the web server will serve /path/installation/index.html when someone tries to access /path/information. Generating /path/installation.html is for preserving backward compatibility.

GitHub Pages serves /path/installation.html if a user tries to access /path/installation when /path/installation/index.html does not exist, so if we are only targeting GitHub pages hosting, this is a non-issue. But since we want to support any static file hosting service, this support is necessary.

@endiliey
Copy link
Contributor

endiliey commented May 19, 2018

Hi, I wanted to try working on this.

@endiliey endiliey added status: claimed Issue has been claimed by a contributor who plans to work on it. 🕐PR Pending labels Jun 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: intermediate Issues that are medium difficulty level, e.g. moderate refactoring with a clear test plan. feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: claimed Issue has been claimed by a contributor who plans to work on it.
Projects
None yet
Development

No branches or pull requests

5 participants