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 from routes #270

Closed
harryhorton opened this issue Apr 26, 2018 · 3 comments
Closed

Remove .html from routes #270

harryhorton opened this issue Apr 26, 2018 · 3 comments

Comments

@harryhorton
Copy link

harryhorton commented Apr 26, 2018

  • Your OS : Windows 10
  • Node.js version: 9.8
  • VuePress version: 0.8.4
  • Browser version: Chrome 66
  • Is this a global or local install?: Local
  • Which package manager did you use for the install? Yarn

Question:
Is there a way to remove the trailing .html on pages? I'm testing this both locally and on GitHub pages.

Ignoring the fact that this isn't fleshed out at all: https://johnhhorton.github.io/vividdev.com/posts/ us using README.me under the posts folder and resolves correctly. When navigating to an individual post like https://johnhhorton.github.io/vividdev.com/posts/PostWithCodeExample.html the .html extension is required.

While the focus of VuePress is for docs, I don't have any problem building in my own blog friendly features, but I would imagine that page URLs without .html would be preferable. I would imagine this is especially important for someone porting another non .html site to this one for SEO reasons.

@mdaffin
Copy link
Contributor

mdaffin commented Apr 26, 2018

Duplicate of #78.

The current workaround is to rename your post to index.md and place it inside a subfolder so you have posts/myarticle/index.md (note that you can use README.md instead of index.md). This will generate /myarticle/index.html which almost all static web servers will serve when the user hits /myarticle/.

For an example see my blog

One benefit to this workaround is you can store assets (such as images) under the same directory as the index.md to keep your posts self-contained.

@harryhorton
Copy link
Author

@mdaffin Thanks, I'll use that for now.

@ulivz ulivz closed this as completed Apr 26, 2018
@awulkan
Copy link

awulkan commented Jun 22, 2018

@mdaffin The drawback is that it adds a trailing slash on all post URLs. This will for sure cause problems if you ever decide to change to another generator or CMS.

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

4 participants