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

✨ Remove '.html' extension from URLs #1060

Closed
wants to merge 5 commits into from
Closed

✨ Remove '.html' extension from URLs #1060

wants to merge 5 commits into from

Conversation

dcastil
Copy link
Contributor

@dcastil dcastil commented Dec 1, 2018

Summary

As discussed in #608 and a few other issues, it would be nice to enhance user experience regarding URLs created by vuepress. I want to make a first step towards this goal with this PR and removed the .html extension at the end of all URLs. So the URL /about.html gets /about/.

However, there is some more work to be done.

  1. When I start a project with vuepress dev and request a URL without the trailing /, the router gets into an infinite loop and a blank website is shown.

  2. Generally the trailing / should be removed from all URLs. Removing the .html extension is only the first step and I wouldn't ship this to production as is.

  3. Some refactoring might be needed as a lot of code was built with the URL extension in mind.

I'm open for suggestions and help.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

If changing the UI of default theme, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

You have tested in the following browsers: (Providing a detailed version will be better.)

  • Chrome
  • Firefox
  • Safari
  • Edge
  • IE

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature
    This comment from awulkan has some convincing reasons.
  • Related documents have been updated
  • Related tests have been updated

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:

I'm not sure if I have enough time to go though all the points mentioned in the summary. If anyone wants to pick up from my work, feel free to fork from my repo and continue working on that.

Copy link
Member

@ulivz ulivz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your great work, but this feature would affect all the old websites and some people would still prefer the URLs with .html suffix, I think it's better to create a config (e.g. htmlSuffix, defaults to true) for this feature.

@dcastil
Copy link
Contributor Author

dcastil commented Dec 4, 2018

@ulivz I created a possible solution. But it makes a lot of functions dependent on the htmlSuffix which I don't like, there might be a better solution. I also don't understand why I need to add .replace(endingSlashRE, '') to the normalize function. If I don't do it, the router errors and the sidebar breaks.

@ulivz ulivz force-pushed the master branch 3 times, most recently from 6c3127f to 71574f2 Compare December 18, 2018 18:27
@ulivz ulivz force-pushed the master branch 5 times, most recently from 316e022 to 1284944 Compare January 29, 2019 11:47
@awulkan
Copy link

awulkan commented Feb 4, 2019

Any update on this? It's the main blocker for me if I'm ever going to consider VuePress. I know a lot of people want it, and have tried to solve it (me included), but I think we need help from the main developers of VuePress to do it.

@dcastil
Copy link
Contributor Author

dcastil commented Feb 5, 2019

Unfortunately I don't have time to work on this currently. I'm closing the PR as it is out of date and has too many conflicts.

@dcastil dcastil closed this Feb 5, 2019
@awulkan
Copy link

awulkan commented Feb 5, 2019

Understandable. Thanks for the effort.
I'll check back on VuePress in a few months again, maybe someone in the core team has seen the benefits of it by then.

@shigma shigma reopened this Feb 23, 2019
@shigma shigma self-assigned this Feb 23, 2019
@shigma shigma mentioned this pull request Feb 23, 2019
@shigma shigma requested a review from ulivz February 23, 2019 04:53
@shigma
Copy link
Collaborator

shigma commented Feb 26, 2019

See #1339

@shigma shigma closed this Feb 26, 2019
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

Successfully merging this pull request may close these issues.

4 participants