I have a project where documentation is used in the field, and an internet connection is often not available. Starting a local web server is also not an option. Most likely the documentation will be shipped on a USB stick or CD-ROM.
Therefore, all links must be relative and point to ./foo/index.html instead of just ./foo
mkdocs does have a config option for this use case:
http://www.mkdocs.org/user-guide/configuration/#use_directory_urls
Is it possible to configure vuepress in the same way?
Sorry I cannot know what's your question. If you need help, please DON'T ignore the issue template, and provide a reproduced repo anyhow.
Not sure if it will work, but try setting base to .? 馃槀馃槀
@ulivz: Sorry for the lack of information. Here it is:
Steps to reproduce:
mkdir bug387
mkdir bug387/subdir
cd bug387
echo "# Link to [subdir](subdir)" > README.md
echo "# Subdirectory page" > subdir/README.md
vuepress build
cd .vuepress/dist
firefox index.html # or chromium-browser for that matter
Results:
subdir instead of subdir/index.html)Expected:
Use case:
I want to generate static docs that can be shipped on an USB stick, and can be viewed
by clicking on index.html (without internet access or a local HTTP server).
By manually editing the links in the HTML, I can get it to work.
Only thing missing is a config option like mkdocs' use_directory_urls.
@ycmjason:
After echo "module.exports = { base: '.' }" > .vuepress/config.js:
index.html now leads to a (correctly styled) "404" page.Can you please reopen the bug?
Try ./ then?
Exactly the same as above. Asset URLs in subdir refer to "./assets/xxx", when "../assets/xxx" would be correct.
It could be a bug. I remember that publicPath coulde be set to an empty string, and the urls would be assets/xxx
I find it, it could be a bug of vue-server-renderer
href="${this.publicPath}/${file}"
src="${this.publicPath}/${file}"
So there will always be a / even if the webpackConfig.output.publicPath is empty
Issue submitted
Has this bug been fixed yet?
Please re-open!
This has been my experience trying to get this to work using the following files...
.vuepress/config.js
module.exports = {
// using the full path instead of relative path
// this can be changed to the folder to host the static files
base: '/full/path/to/project/.vuepress/dist/'
}
README.md
# homepage
[page2](./page2.md)
## subtitle
Lorem ipsum dolor sit amet, alterum volumus pro ut
page2.md
# page2
[home](./README.md)
## another subtitle
After vuepress build all the pages other than index.html will load and display correctly. The full path has been set in base. Similarly any links to subheadings will work on the other pages but not on the index.html page. Loading the generated static site from the file system would require that the URL include /path/.vuepress/dist/index.html and when linking to subheadings also requires the index.html within the URL e.g. /path/.vuepress/dist/index.html#subtitle.
Any ideas??
I did a thing :D vuepress-offlinify
You can set base to a absolute path
`
// .vuepress/config.js
const basePath = process.env.Node_ENV === 'production' ? path.resolve(__dirname, './dist') : '/';
module.esport = { title: '', base: basePath}
`
Most helpful comment
Has this bug been fixed yet?
Please re-open!