When I run docfx docfx.json --serve
and go to localhost:8080
, I see two items on the top menu: "Articles" and "Api Documentation". When I navigate in the filesystem to _site\
and click on index.html
to open it in Chrome, these menu items are missing. How can I make sure the menu is properly set when I run it as a static site?
I need to be able to package the html files and send them to people for them to view locally without them having to download the repo and install docFX.
Reason: The page needs extra JS files to the navigation bar, but it is blocked by Chrome. You can see these errors in Chrome console (F12):
docfx.vendor.js:4 Access to XMLHttpRequest at 'file:///C:/git/docfx-seed/_site/toc.html' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
send @ docfx.vendor.js:4
docfx.vendor.js:4 Access to XMLHttpRequest at 'file:///C:/git/docfx-seed/_site/logo.svg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
Solution: Use template statictoc
, which already embedded all the required parts into HTML file:
docfx docfx.json -t statictoc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With