Vuepress: Remove .html from routes

Created on 26 Apr 2018  路  3Comments  路  Source: vuejs/vuepress

  • 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.

Most helpful comment

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.

All 3 comments

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.

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

@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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AMontagu picture AMontagu  路  3Comments

lesliecdubs picture lesliecdubs  路  3Comments

cfjedimaster picture cfjedimaster  路  3Comments

ynnelson picture ynnelson  路  3Comments

FadySamirSadek picture FadySamirSadek  路  3Comments