facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.37k stars 8.46k forks source link

docusaurus-build generates a broken website #1761

Closed stavalfi closed 5 years ago

stavalfi commented 5 years ago

🐛 Bug Report

(I did not change anything in the website/configurations)

image

image

Reproducible Demo

https://github.com/stavalfi/docusaurus-broken-build

nothing was changed in siteConfig.js.


node v: v8.11.3 (later tested with 10.10.3 as well - same results). yarn v: 1.16.0 mac v: mojave 10.14.3

endiliey commented 5 years ago

Build is not broken. You are probably serving the build dir from wrong folder.

What command did you run to serve the build locally ? Send screencast ..

Will re-open if proven not working

stavalfi commented 5 years ago

@endiliey I opened the index.html with chrome..


Okay I get you now.

I'm also facing the same problem when using netlify. Why it doesn't work there. (I followed the steps in the toturial).

yangshun commented 5 years ago

Try starting a local web server with python -m SimpleHTTPServer 8000 in the build dir and go to http://localhost:8000/<baseUrl>. You should see it.

stavalfi commented 5 years ago

@yangshun I it's working locally. But what should I do to make it work in Netlify? @endiliey

astrotim commented 4 years ago

I'm seeing this as well. Any URL without a trailing slash redirects to localhost:8000

The navigation generates URLs without a trailing slash, which if copied and shared, will redirect to a localhost:8000 URL. In other words, the client side routing works, but the browser trying to load a URL directly doesn't.

e.g. https://mydocs.com/path/to/doc redirects to → http://localhost:8000/path/to/doc/

LLejoly commented 4 years ago

python -m SimpleHTTPServer 8000

I faced the same issue. and running an http server to access the build folder works. This extra step should be mentioned in the official documentation.

slorber commented 4 years ago

@LLejoly there's ongoing work to provide an official "docusaurus serve" command: https://github.com/facebook/docusaurus/issues/3062

This is a jamstack SPA project, not all http servers will work perfectly with it, so we'd rather recommend one.